You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pvenini <pv...@mervaros.com.ar> on 2011/07/18 16:05:19 UTC

Re: Re: Translate FIX message to HTTP request

Hi, I finally managed to go forward a few steps by modifying the quickfix
converter. The route I'm building looks like this:

from("quickfix:config.cfg").
filter(   	
 
header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.ORDER_SINGLE)).
unmarshal(camelDataFormat).
to("jetty:http://localhost:8502/trade.php").
process(new HttpResponseProcessor()).
marshal(camelDataFormat).
to("quickfix:config.cfg"); 

The idea is that the FIX NewOrderSingle message is parsed by Bindy, an HTTP
request is generated an sent to the destination server and depending on the
response, a FIX message is sent back (an ExecutionReport). 
This works OK up to the point of the marshal part, but when it gets to the
to:quickfix.cfg (the final destination in the route), the inMessage reverts
to the original NewOrderSingle message, an the Quickfix component throws a
null pointer exception.
Question is: is this route correct (I'm using the same endpoint for the
consumer and the producer) and if not, what should be the correct way to
send the response back?

Thanks

Pablo

--
View this message in context: http://camel.465427.n5.nabble.com/Translate-FIX-message-to-HTTP-request-tp4492401p4599664.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Re: Translate FIX message to HTTP request

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jul 18, 2011 at 4:05 PM, pvenini <pv...@mervaros.com.ar> wrote:
> Hi, I finally managed to go forward a few steps by modifying the quickfix
> converter. The route I'm building looks like this:
>
> from("quickfix:config.cfg").
> filter(
>
> header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.ORDER_SINGLE)).
> unmarshal(camelDataFormat).
> to("jetty:http://localhost:8502/trade.php").
> process(new HttpResponseProcessor()).
> marshal(camelDataFormat).
> to("quickfix:config.cfg");
>
> The idea is that the FIX NewOrderSingle message is parsed by Bindy, an HTTP
> request is generated an sent to the destination server and depending on the
> response, a FIX message is sent back (an ExecutionReport).
> This works OK up to the point of the marshal part, but when it gets to the
> to:quickfix.cfg (the final destination in the route), the inMessage reverts
> to the original NewOrderSingle message, an the Quickfix component throws a
> null pointer exception.
> Question is: is this route correct (I'm using the same endpoint for the
> consumer and the producer) and if not, what should be the correct way to
> send the response back?
>

It depends on the consumer. Some supports a request/response pattern.
For example a web server, where a HTTP client send a request to the
web server, and the web server sends back a response.

The FIX consumer may support that as well, if a client is to do a request/reply.
In those cases you just do

from X
  filter
  to Y
  marshal
  to Z

So the idiom is that when the route "ends" then the consumer gets
control back and can send back the reply message, based on what the
message currently has been set as.



> Thanks
>
> Pablo
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Translate-FIX-message-to-HTTP-request-tp4492401p4599664.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Re: Translate FIX message to HTTP request

Posted by pvenini <pv...@mervaros.com.ar>.
Hi, I created CAMEL-4278. It adds one method to convert from byte[] to
Message, and one to convert from quickfixj.Message to InputStream. I had to
add them both to be able to marshal/unmarshal quickfixj messages with Bindy.

Pablo

--
View this message in context: http://camel.465427.n5.nabble.com/Translate-FIX-message-to-HTTP-request-tp4492401p4644392.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Re: Translate FIX message to HTTP request

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 21, 2011 at 11:08 PM, pvenini <pv...@mervaros.com.ar> wrote:
> I solved the problem adding a type converter from byte array (the result of
> Bindy's marshal) to quickfix Message. The QuickFixConverter that cames with
> the examples has a method to convert from String to quickfix Message so it
> wasn't used.
>

Fell free to contribute a byte[] -> quickfix message converter. Then
we can include that in the component out of the box.
http://camel.apache.org/contributing.html

> --
> View this message in context: http://camel.465427.n5.nabble.com/Translate-FIX-message-to-HTTP-request-tp4492401p4621016.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Re: Translate FIX message to HTTP request

Posted by pvenini <pv...@mervaros.com.ar>.
I solved the problem adding a type converter from byte array (the result of
Bindy's marshal) to quickfix Message. The QuickFixConverter that cames with
the examples has a method to convert from String to quickfix Message so it
wasn't used.

--
View this message in context: http://camel.465427.n5.nabble.com/Translate-FIX-message-to-HTTP-request-tp4492401p4621016.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Re: Translate FIX message to HTTP request

Posted by vcheruvu <v_...@hotmail.com>.
would you mind showing the  details of config.cfg. I believe there is some
config issue in your end  that you need to specify somethig like below
statement. Also, If you can show me the stack trace of your null pointer,
then it could help me to see where and how you are experiencing the issue.

to("quickfix:config.cfg?sessionID=FIX.4.2:SENDERCOMPID->TARGETCOMPID")


kind regards,
-Vid-

--
View this message in context: http://camel.465427.n5.nabble.com/Translate-FIX-message-to-HTTP-request-tp4492401p4613914.html
Sent from the Camel - Users mailing list archive at Nabble.com.