Hi

I think what you could use is the "choice" or "filter" DSL. 

So if the choice predicate returns "true" (=YES from jbi) then you can send the 
original message, otherwise it can be send to a logging queue etc.

The filter is like choice however with no otherwise.

The predicate for evaluating the "true|false" could be a POJO that calls the 
JBI endpoint and returns a boolean true|false.

from(x).
  filter().method("myJBIBean", " mySuperMethod").
    to(y);

http://activemq.apache.org/camel/message-router.html
http://activemq.apache.org/camel/message-filter.html

Then you bean callJBI is a POJO where you can call the jbi stuff and get the 
response and return true or false

http://activemq.apache.org/camel/bean-language.html


Public class MyJBICallingBean {

   Private ProducerTemplate template;

   Public Boolean mySuperMethod(Exchange exchange) {
      // call JBI (you can use a ProducerTemplate here
      String response = template.sendBody("jbi:xxxx", "Hello World", 
String.class);
     
      return "response".equals("YES");
   }

   Public void setProducerTemplate();

}

You can use standard setter to set the producer template and let spring inject 
it. You can also use annotations. (Or implements a CamelContextAware interface 
I think)

http://activemq.apache.org/camel/bean-binding.html

There is an annotation @EndpointInject that can inject endpoints, producer 
templates etc. Check out the source code in test unit tests for camel-spring

Sorry but I don't have more time to write more. Good luck.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: raulvk.soa [mailto:[EMAIL PROTECTED] 
Sent: 8. oktober 2008 11:05
To: [email protected]
Subject: Call-out pattern


Hi everyone,

We need to implement a specific routing scenario for which we are
considering either BPEL or Camel, but we are not sure whether Camel actually
supports its implementation.

Basically, we need to achieve a pattern by which, when receiving a message,
we first call out to endpoint A (via ServiceMix JBI), that decides whether
the message should be processed or not. The message sent to this endpoint
should be a *NEW* message, and not a transformation/replacement of the
incoming message.

If the answer from endpoint A is "yes", then we recover the original
message, transform it accordingly and send it to endpoint B.

Therefore, we cannot use the pipeline clause because we do not want the
output of endpoint A to be the input to endpoint B. Instead, we need
something like a call-out that preserves the original message untouched....

Is this achievable with Camel? Perhaps by using nested routes?

Many thanks,

Raul.

-- 
View this message in context: 
http://www.nabble.com/Call-out-pattern-tp19875054s22882p19875054.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to