Hi

I have given it some more thought and based on the problems that
Charles highlighted with doing quickfix over JMS.

I really do think quickfix should be a DataFormat. Just like HL7 (camel-hl7).

Using it as a DataFormat we avoid the problem with double type convertion.

It looks for me its common to go from a String based notion of
quickfix to a real QuickFixMessage model object.
And vice-versa.

This is excaclty the same with camel-hl7.

So Charles I suggest you take a look at camel-hl7 in its HL7DataFormat
class. And see if its not possible to do more or likes the same for
QuickFix.


On Mon, May 11, 2009 at 10:44 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> On Mon, May 11, 2009 at 10:12 AM, Charles Moulliard
> <cmoulli...@gmail.com> wrote:
>> I have added the following line in the QuickFixConverter and now it works.
>>
>>   �...@converter
>>    public static Message toMessage(JmsMessage message) throws IOException,
>> InvalidMessage {
>>        String text = (String)message.getBody();
>>        return new Message(text);
>>    }
>>
>> I will attach a patch with the modifications done in this class.
> No you cannot do this. camel-quickfix should not be dependent on JMS API.
> Its you that brings JMS in the mix and must deal with its implications.
>
> So yes if you want that you should convert to String first and then
> afterwards to QuickFix Message.
>
> But the problem also lies in the fact how camel-jms is implemented
> that it contains the payload as a JmsMessage.
> That I do not like as it should use Java neutral types such as
> InputStream, String, byte[] etc. But that is another story.
>
>
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>>
>>
>> On Mon, May 11, 2009 at 10:04 AM, Charles Moulliard 
>> <cmoulli...@gmail.com>wrote:
>>
>>> Claus,
>>>
>>> Camel can find the quickfix converter.
>>>
>>> In my case, do I have to create a converter like JmsMessage -->
>>> quickFix.Message this instead of a String --> quickFix.Message because this
>>> is what camel says in the error ?
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>> Senior Enterprise Architect
>>> Apache Camel Committer
>>>
>>> *****************************
>>> blog : http://cmoulliard.blogspot.com
>>>
>>>
>>> On Mon, May 11, 2009 at 9:57 AM, Claus Ibsen <claus.ib...@gmail.com>wrote:
>>>
>>>> On Mon, May 11, 2009 at 9:35 AM, Charles Moulliard <cmoulli...@gmail.com>
>>>> wrote:
>>>> > Claus,
>>>> >
>>>> > Here is what I created :
>>>> >
>>>> >   �...@converter
>>>> >    public static Message toMessage(String message) throws IOException,
>>>> > InvalidMessage {
>>>> >        return new Message(message);
>>>> >    }
>>>> >
>>>> > in the class QuickFixConverter but the same error is reported
>>>> Maybe it cannot find the type converter. Try debugging.
>>>>
>>>> There should be some file in src/main/resources/META-INF that points
>>>> to this type converter.
>>>>
>>>>
>>>>
>>>>
>>>> >
>>>> > Regards,
>>>> >
>>>> > Charles Moulliard
>>>> > Senior Enterprise Architect
>>>> > Apache Camel Committer
>>>> >
>>>> > *****************************
>>>> > blog : http://cmoulliard.blogspot.com
>>>> >
>>>> >
>>>> > On Mon, May 11, 2009 at 9:25 AM, Claus Ibsen <claus.ib...@gmail.com>
>>>> wrote:
>>>> >
>>>> >> On Mon, May 11, 2009 at 9:16 AM, Charles Moulliard <
>>>> cmoulli...@gmail.com>
>>>> >> wrote:
>>>> >> > Hi,
>>>> >> >
>>>> >> > I have created the following camel routes where my messages received
>>>> from
>>>> >> > the FIX server are placed in a queue.
>>>> >> >
>>>> >> >        <camel:route>
>>>> >> >            <camel:from
>>>> >> uri="quickfix-server:META-INF/examples/server.cfg"/>
>>>> >> >            <camel:convertBodyTo type="java.lang.String"/>
>>>> >> >            <camel:to uri="queuingservice:queue:fix"/>
>>>> >> >        </camel:route>
>>>> >> >        <camel:route>
>>>> >> >            <camel:from uri="queuingservice:queue:fix"/>
>>>> >> >            <camel:convertBodyTo type="quickfix.Message"/>
>>>> >> >            <camel:to
>>>> uri="quickfix-client:META-INF/examples/client.cfg"/>
>>>> >> >        </camel:route>
>>>> >> >
>>>> >> > When the messages are read from the queue and converted, the
>>>> following
>>>> >> error
>>>> >> > is reported.
>>>> >> >
>>>> >> > 08:51:36,515 | INFO  | enerContainer-23 | TraceInterceptor
>>>> >>   |
>>>> >> > rg.apache.camel.processor.Logger  127 |
>>>> >> > ID-dell-charles-1611-1242019089609-2-5 >>>
>>>> >> > to(quickfix-client:META-INF/examples/client.cfg) -->
>>>> >> > to(quickfix-client:META-INF/examples/client.cfg), Pattern:InOut,
>>>> >> >
>>>> >>
>>>> Properties:{JMSReplyTo=temp-queue://ID:dell-charles-1607-1242019074921-2:2:1},
>>>> >> > Headers:{JMSXGroupID=null,
>>>> >> > JMSCorrelationID=ID-dell-charles-1611-1242019089609-3-0,
>>>> JMSType=null,
>>>> >> > JMSExpiration=1242024716484,
>>>> >> > JMSMessageID=ID:dell-charles-1607-1242019074921-2:2:3:1:1,
>>>> >> > JMSRedelivered=false, JMSDeliveryMode=2, JMSPriority=4,
>>>> >> > JMSReplyTo=temp-queue://ID:dell-charles-1607-1242019074921-2:2:1,
>>>> >> > JMSTimestamp=1242024696484, JMSDestination=queue://fix},
>>>> BodyType:String,
>>>> >> > Body:8=FIX.4.1 9=102 35=D 34=82 49=BANZAI 52=20090511-06:51:32
>>>> 56=FIXGW
>>>> >> 11=1242024692768 21=1 38=150 40=1 54=1 55=SUN 59=0 10=051
>>>> >> > 08:51:36,515 | ERROR | enerContainer-23 | DeadLetterChannel
>>>> >>  |
>>>> >> > rg.apache.camel.processor.Logger  207 | Failed delivery for
>>>> exchangeId:
>>>> >> > ID:dell-charles-1607-1242019074921-2:2:3:1:1. On delivery attempt: 0
>>>> >> caught:
>>>> >> > org.apache.camel.NoTypeConversionAvailableException: No type
>>>> converter
>>>> >> > available to convert from type:
>>>> org.apache.camel.component.jms.JmsMessage
>>>> >> to
>>>> >> > the required type: quickfix.Message with value JmsMessage:
>>>> >> > ActiveMQTextMessage {commandId = 10, responseRequired = true,
>>>> messageId =
>>>> >> > ID:dell-charles-1607-1242019074921-2:2:3:1:1, originalDestination =
>>>> null,
>>>> >> > originalTransactionId = null, producerId =
>>>> >> > ID:dell-charles-1607-1242019074921-2:2:3:1, destination =
>>>> queue://fix,
>>>> >> > transactionId = null, expiration = 1242024716484, timestamp =
>>>> >> 1242024696484,
>>>> >> > arrival = 0, brokerInTime = 1242024696484, brokerOutTime =
>>>> 1242024696500,
>>>> >> > correlationId = ID-dell-charles-1611-1242019089609-3-0, replyTo =
>>>> >> > temp-queue://ID:dell-charles-1607-1242019074921-2:2:1, persistent =
>>>> true,
>>>> >> > type = null, priority = 4, groupID = null, groupSequence = 0,
>>>> >> > targetConsumerId = null, compressed = false, userID = null, content =
>>>> >> null,
>>>> >> > marshalledProperties = null, dataStructure = null, redeliveryCounter
>>>> = 0,
>>>> >> > size = 0, properties = null, readOnlyProperties = true, readOnlyBody
>>>> =
>>>> >> true,
>>>> >> > droppable = false, text =
>>>> >> > 8=FIX.4.1 9=102 35=D 34=82 49=BANZAI 52=20090...59=0 10=051 }
>>>> >> > org.apache.camel.NoTypeConversionAvailableException: *No type
>>>> converter
>>>> >> > available to convert from type:
>>>> org.apache.camel.component.jms.JmsMessage
>>>> >> to
>>>> >> > the required type: quickfix.Message* with value JmsMessage:
>>>> >> > ActiveMQTextMessage {commandId = 10, responseRequired = true,
>>>> messageId =
>>>> >> > ID:dell-charles-1607-1242019074921-2:2:3:1:1, originalDestination =
>>>> null,
>>>> >> > originalTransactionId = null, producerId =
>>>> >> > ID:dell-charles-1607-1242019074921-2:2:3:1, destination =
>>>> queue://fix,
>>>> >> > transactionId = null, expiration = 1242024716484, timestamp =
>>>> >> 1242024696484,
>>>> >> > arrival = 0, brokerInTime = 1242024696484, brokerOutTime =
>>>> 1242024696500,
>>>> >> > correlationId = ID-dell-charles-1611-1242019089609-3-0, replyTo =
>>>> >> > temp-queue://ID:dell-charles-1607-1242019074921-2:2:1, persistent =
>>>> true,
>>>> >> > type = null, priority = 4, groupID = null, groupSequence = 0,
>>>> >> > targetConsumerId = null, compressed = false, userID = null, content =
>>>> >> null,
>>>> >> > marshalledProperties = null, dataStructure = null, redeliveryCounter
>>>> = 0,
>>>> >> > size = 0, properties = null, readOnlyProperties = true, readOnlyBody
>>>> =
>>>> >> true,
>>>> >> > droppable = false, text =
>>>> >> > 8=FIX.4.1 9=102 35=D 34=82 49=BANZAI 52=20090...59=0 10=051 }
>>>> >> >    at
>>>> >> >
>>>> >>
>>>> org.apache.camel.impl.converter.DefaultTypeConverter.doConvertTo(DefaultTypeConverter.java:155)
>>>> >> >    at
>>>> >> >
>>>> >>
>>>> org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:98)
>>>> >> >    at
>>>> >> >
>>>> >>
>>>> org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:94)
>>>> >> >    at
>>>> >> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:86)
>>>> >> >    at
>>>> >> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:52)
>>>> >> >    at
>>>> >> >
>>>> >>
>>>> org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelper.java:135)
>>>> >> >
>>>> >> > Questions :
>>>> >> >
>>>> >> > - Do I have to get the body from the JmsMessage before to call
>>>> >> convertBody ?
>>>> >> No
>>>> >>
>>>> >> > - Do I have to create in QuickFixConverter a method to handle this
>>>> case ?
>>>> >> Yes. You have put a String message on the JMS queue.
>>>> >> And when you consume this message from the JMS queue you try to
>>>> >> convert it to a FixMessage.
>>>> >>
>>>> >> This is the route you do
>>>> >>         <camel:route>
>>>> >>            <camel:from uri="queuingservice:queue:fix"/>
>>>> >>            <camel:convertBodyTo type="quickfix.Message"/>
>>>> >>            <camel:to
>>>> uri="quickfix-client:META-INF/examples/client.cfg"/>
>>>> >>        </camel:route>
>>>> >>
>>>> >> And what is needed is a String -> FixMessage TypeConverter.
>>>> >>
>>>> >> Usually you create a method in FixConverter (or what the class was
>>>> >> named) and define a method like
>>>> >>
>>>> >> @Converter
>>>> >> FixMessage toFixMessage(String body, Exchange exchange) {
>>>> >>  ... do the convertions here
>>>> >> }
>>>> >>
>>>> >>
>>>> >> See more about type converter here:
>>>> >> http://camel.apache.org/type-converter.html
>>>> >>
>>>> >> >
>>>> >> > Regards,
>>>> >> >
>>>> >> > Charles Moulliard
>>>> >> > Senior Enterprise Architect
>>>> >> > Apache Camel Committer
>>>> >> >
>>>> >> > *****************************
>>>> >> > blog : http://cmoulliard.blogspot.com
>>>> >> >
>>>> >>
>>>> >>
>>>> >>
>>>> >> --
>>>> >> Claus Ibsen
>>>> >> Apache Camel Committer
>>>> >>
>>>> >> Open Source Integration: http://fusesource.com
>>>> >> Blog: http://davsclaus.blogspot.com/
>>>> >> Twitter: http://twitter.com/davsclaus
>>>> >> Apache Camel Reference Card:
>>>> >> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>> >> Interview with me:
>>>> >>
>>>> >>
>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>> >>
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>> Apache Camel Reference Card:
>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>> Interview with me:
>>>>
>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>
>>>
>>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> Interview with me:
> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress

Reply via email to