You should leverage Camels
- Producer
- Consumer
for whether its a ACCEPTOR or INITIATOR in QuickFix.
Producer = the one that spits out FIX messages
Consumer = the one that inputs FIX messages.
The Endpoint is the same for both of them.
Whether its a consumer or producer is usually defined how you build the route.
- from("xxx") = consumer
- to("xxx") = producer
Or you can use the Camel API to create either a producer or consumer
from the endpoint
- Producer producer = endpoint.createProducer();
- Consumer consumer = endpoint.createConsumer();
( however not used that much as the DSL is much more convenient)
On Fri, May 8, 2009 at 11:28 AM, Charles Moulliard <[email protected]> wrote:
> Something like the CXF component can do with its DataFormat type?
> ?dataFormat=String
> ?dataFormat=QuickFixMessage
>
> I will check what is implemented in the camel-cxf component.
> *Are you looking for another camel feedback concerning your proposal ?*
>
> But why are you setting both the IN and OUT to the same message?
> Good question. Anton is the author so I can't reply BUT
> In quickfix, the application (
> http://www.quickfixj.org/quickfixj/usermanual/usage/application.html) which
> is the engine communicating with a FIX server can be of type ACCEPTOR or
> INITIATOR. You have to both configure the two applications because the
> engine is not a client/server application. In one case, you accept incoming
> messages and in the other you generate the messages. The camel-quickfix does
> not know which role it plays because it is defined in the config.file
> provided as input to the quickFixAcceptor or quickFixInitiator class. These
> two classes call the same QuickFixEndpoint.
> *
> Maybe the class has to be splitted in two endpoints, one corresponding to
> each to avoid both IN/OUT ???*
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Fri, May 8, 2009 at 9:52 AM, Claus Ibsen <[email protected]> wrote:
>
>> On Fri, May 8, 2009 at 9:31 AM, Charles Moulliard <[email protected]>
>> wrote:
>> > Hi,
>> >
>> > Is it possible through camel endpoint, producer, consumer, ... (I don't
>> know
>> > exactly where in camel class), to parameter the output that we would like
>> to
>> > have from a component/endpoint ?
>> >
>> > In the camel-quickfix component, the FIX server implemented (through
>> > quickFix classes) receives messages in the FIX format and map the content
>> > into a quickfix.Message (can be of type quickfix, FIX40, quickfix.FIX41,
>> > ...).
>> >
>> > What I would like to do is have the possibility through the Camel
>> endpoint
>> > to tell to the component that I want to receive the FIX messages mapped
>> or
>> > not ?
>> >
>> > e.g. From("quickfixserver?type=String") or
>> > From("quickfixserver?type=quickFix.Message")
>> Something like the CXF component can do with its DataFormat type?
>> ?dataFormat=String
>> ?dataFormat=QuickFixMessage
>>
>> And it should default to QuickFixMessage
>>
>>
>> >
>> > By analysing the code, I have discovered that the method : receive as
>> > parameter the quickFix.Message
>> >
>> > What is the best approach to implement this in the endpoint ?
>> >
>> > 1) Create 2 createExchange(Message message) createExchange(String string)
>> >
>> > or change the existing to let the consumer/producer to return a
>> > String/Message/XML/....
>> >
>> > Here is a snapshot of the code :
>> >
>> > public void onMessage(Message message) {
>> > Exchange exchange = createExchange(message);
>> > try {
>> > processor.process(exchange);
>> > } catch (Exception e) {
>> > exchange.setException(e);
>> > }
>> >
>> > }
>> >
>> > public Exchange createExchange(Message message) {
>> > setExchangePattern(ExchangePattern.InOut);
>> > Exchange answer = createExchange();
>> > answer.getIn().setBody(message);
>> > answer.getOut().setBody(message);
>> > return answer;
>> Here is a good spot. You can usually get the endpoint and ask which
>> dataFormat it was configued with.
>> Then you know if its a String or QuickFix message you should set as Body.
>>
>> But why are you setting both the IN and OUT to the same message?
>> Usually it is only IN you set.
>>
>>
>> > }
>> >
>> > // for initiator
>> > public Producer createProducer() throws Exception {
>> > return new QuickfixProducer(this);
>> > }
>> >
>> > // for acceptor
>> > public Consumer createConsumer(Processor processor) throws Exception {
>> > this.processor = processor;
>> > return new QuickfixConsumer(this, processor);
>> > }
>> >
>> > 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