You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Alexandros Karypidis <ak...@yahoo.gr> on 2010/03/18 18:42:15 UTC

Synchronous MEP across camel contexts

Hi,

I would like to perform a synchronous in/out exchange across different 
camel contexts.

I tried using "direct" components but those do not span contexts. The 
only component I've found that does that, is the "vm" component. 
Unfortunately, "vm" does one-way exchanges, so it's not suitable for 
what I need.

Any ideas how to go about doing this?

Thanks in advance for your help.


Re: Synchronous MEP across camel contexts

Posted by Ashwin Karpe <as...@progress.com>.
Hi,

You could use ActiveMQ as suggested by Stephen or alternatively you could
use Camel Mina (TCP) with sync=true

 for e.g 
On Consumer
---------------
from("mina:tcp://localhost:9123?sync=true")
    .process(new Processor() {
        public void process(Exchange exchange) throws Exception {
            String payload = exchange.getIn().getBody(String.class);
            // do something with the payload and/or exchange here
           exchange.getIn().setBody("Changed body");
       }
    });

In Producer
-------------
from("file:src/test/data?noop=true")
     .to("mina:tcp://localhost:9123?sync=true&lazySessionCreation=true").
     .process(new Processor() {
       public void process(Exchange exchange) throws Exception {
            String result = exchange.getIn().getBody(String.class);
            // Do something with received result....
       }
    });

Hope this helps.

Cheers,

Ashwin...

karypid wrote:
> 
> Ok, apologies for this post; "vm" does support "in-out" and I simply had 
> to explicitly set the pattern when creating the exchange, as follows:
> 
> Exchange exchange = camelContext.getEndpoint("direct:origin")
> .createExchange(ExchangePattern.InOut); // not just createExchange() 
> without param!
> 
> 
> 
> On 18/3/2010 7:42 μμ, Alexandros Karypidis wrote:
>> Hi,
>>
>> I would like to perform a synchronous in/out exchange across different 
>> camel contexts.
>>
>> I tried using "direct" components but those do not span contexts. The 
>> only component I've found that does that, is the "vm" component. 
>> Unfortunately, "vm" does one-way exchanges, so it's not suitable for 
>> what I need.
>>
>> Any ideas how to go about doing this?
>>
>> Thanks in advance for your help.
> 
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: http://old.nabble.com/Synchronous-MEP-across-camel-contexts-tp27949016p27949880.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Synchronous MEP across camel contexts

Posted by Alexandros Karypidis <ak...@yahoo.gr>.
Ok, apologies for this post; "vm" does support "in-out" and I simply had 
to explicitly set the pattern when creating the exchange, as follows:

Exchange exchange = camelContext.getEndpoint("direct:origin")
.createExchange(ExchangePattern.InOut); // not just createExchange() 
without param!



On 18/3/2010 7:42 μμ, Alexandros Karypidis wrote:
> Hi,
>
> I would like to perform a synchronous in/out exchange across different 
> camel contexts.
>
> I tried using "direct" components but those do not span contexts. The 
> only component I've found that does that, is the "vm" component. 
> Unfortunately, "vm" does one-way exchanges, so it's not suitable for 
> what I need.
>
> Any ideas how to go about doing this?
>
> Thanks in advance for your help.


Re: Synchronous MEP across camel contexts

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Mar 19, 2010 at 9:22 AM, Meise, Christoph
<ch...@immobilienscout24.de> wrote:
> Interestingly the Direct component is able to span across context. Imagine you have two spring files with each containing route definitions. All external interface endpoints ("from:" and the final "to:") are declared in a third spring file (outside of any camel context). Addinitionally the third spring file <includes> the route definitions. The two route definitions are connected via "direct:" endpoints and it works. Is that a bug or a feature?
>

Can you show an example?
And which server do you use to run it?
And what version of Camel are you using?



> Regards,
> christoph
>
> -----Ursprüngliche Nachricht-----
> Von: Stephen Gargan [mailto:steve.gargan@gmail.com]
> Gesendet: Donnerstag, 18. März 2010 18:58
> An: users@camel.apache.org
> Betreff: Re: Synchronous MEP across camel contexts
>
> Cheap and cheerful, you could use JMS, ActiveMQ is very easy to embed
> for this purpose (like a basic NMR). It will give you cross context
> blocking you are looking for and also make it easy to separate the
> contexts across the network if you have to.
>
> ste
>
> On Thu, Mar 18, 2010 at 10:42 AM, Alexandros Karypidis
> <ak...@yahoo.gr> wrote:
>> Hi,
>>
>> I would like to perform a synchronous in/out exchange across different camel
>> contexts.
>>
>> I tried using "direct" components but those do not span contexts. The only
>> component I've found that does that, is the "vm" component. Unfortunately,
>> "vm" does one-way exchanges, so it's not suitable for what I need.
>>
>> Any ideas how to go about doing this?
>>
>> Thanks in advance for your help.
>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

AW: Synchronous MEP across camel contexts

Posted by "Meise, Christoph" <ch...@immobilienscout24.de>.
Interestingly the Direct component is able to span across context. Imagine you have two spring files with each containing route definitions. All external interface endpoints ("from:" and the final "to:") are declared in a third spring file (outside of any camel context). Addinitionally the third spring file <includes> the route definitions. The two route definitions are connected via "direct:" endpoints and it works. Is that a bug or a feature?

Regards,
christoph

-----Ursprüngliche Nachricht-----
Von: Stephen Gargan [mailto:steve.gargan@gmail.com] 
Gesendet: Donnerstag, 18. März 2010 18:58
An: users@camel.apache.org
Betreff: Re: Synchronous MEP across camel contexts

Cheap and cheerful, you could use JMS, ActiveMQ is very easy to embed
for this purpose (like a basic NMR). It will give you cross context
blocking you are looking for and also make it easy to separate the
contexts across the network if you have to.

ste

On Thu, Mar 18, 2010 at 10:42 AM, Alexandros Karypidis
<ak...@yahoo.gr> wrote:
> Hi,
>
> I would like to perform a synchronous in/out exchange across different camel
> contexts.
>
> I tried using "direct" components but those do not span contexts. The only
> component I've found that does that, is the "vm" component. Unfortunately,
> "vm" does one-way exchanges, so it's not suitable for what I need.
>
> Any ideas how to go about doing this?
>
> Thanks in advance for your help.
>
>

Re: Synchronous MEP across camel contexts

Posted by Stephen Gargan <st...@gmail.com>.
Cheap and cheerful, you could use JMS, ActiveMQ is very easy to embed
for this purpose (like a basic NMR). It will give you cross context
blocking you are looking for and also make it easy to separate the
contexts across the network if you have to.

ste

On Thu, Mar 18, 2010 at 10:42 AM, Alexandros Karypidis
<ak...@yahoo.gr> wrote:
> Hi,
>
> I would like to perform a synchronous in/out exchange across different camel
> contexts.
>
> I tried using "direct" components but those do not span contexts. The only
> component I've found that does that, is the "vm" component. Unfortunately,
> "vm" does one-way exchanges, so it's not suitable for what I need.
>
> Any ideas how to go about doing this?
>
> Thanks in advance for your help.
>
>