On 8/29/07, Nicky Sandhu <[EMAIL PROTECTED]> wrote: > > I am still not clear on the contractual difference between a Producer and > Consumer.
The idea is a producer is used to send message Exchanges to an endpoint. A Consumer is an object which consumes (processes) Exchange objects from an endpoint. (So the terms map closely to the JMS MessageProducer / MessageConsumer type model). A Consumer is an instance of the Event Driven Consumer pattern i.e. that the consumer will invoke the given Processor whenever an Exchange is available. ttp://activemq.apache.org/camel/event-driven-consumer.html a PollingConsumer is a, well Polling Consumer :), the user will poll for events http://activemq.apache.org/camel/polling-consumer.html > My context is the wiring service provided in OSGi and there is a > clearly defined Producer and Consumer relationship, ie a Producer is > something that can be polled and a Consumer is something that can be updated > with a polled value. Ofcourse something can be both a Producer and Consumer > > In Camel's case Producer and Consumer are both Services (that is share > lifecycle concepts such as start and stop). A Producer is a just a processor > that can create exchanges in addition to being able to modify the in and out > messages of the exchanges, no production semantics in the interface? A > consumer is just a service, no consumption contract in interface ?? So in terms of the Processor object; a Producer is-a Processor, so the caller can invoke the producer to 'send' a message exchange into the endpoint (such as to write to a file, send a JMS message or perform some remote in/out etc) On the consuming side of the fence, to create a Consumer on an Endpoint you provide a Processor which will be invoked when messages arrive; i.e. a Processor is used just like a MessageListener might be in JMS (or a Servlet) I guess its kinda confusing that both the Producer side is a Processor and to create a Consumer you provide a Processor; the aim was just to promote polymorphism, making it eaiser to chain together producers & consumers into pipelines etc. -- James ------- http://macstrac.blogspot.com/
