camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kraythe ." <kray...@gmail.com>
Subject Re: Camel routing issue
Date Tue, 08 Oct 2013 04:24:24 GMT
Filter has to be first in the route. You can probably only put exception
handling and route id before it. The DSL should probably be tighened up for
that.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Mon, Oct 7, 2013 at 12:51 PM, prabumca06@gmail.com
<prabumca06@gmail.com>wrote:

> Hi all,
>
> Good morning,
>
> I am trying to use when and filter both in my routing,but it didn't work
>
> I hope it will give you idea what i am trying to achieve
>
> from(ACT_TYPE_SPECFIC_QNAME).choice()
>    .when(header(EVENT_TYPE).isEqualTo(ACT_TRANSACTION))
>    .filter(simple("{body[isCredit]} == true"))
>    .process(new Processor() {
>     public void process(Exchange exchange) {
>         Map map = (Map) exchange.getIn().getBody();
>         String Account_No = (String) map.get(ACCOUNT_ID);
>         Map<String,Object> newBody = new HashMap<String, Object>();
>         newBody.put(ACCOUNT_ID, Account_No);
>         exchange.getIn().setBody(newBody);
>
>     }}).to(ACTIVATE_QNAME)
>    .endChoice()
>    .otherwise()
>    .setHeader(DESTINATION, constant(DESTINATION_VALUE))
>    .to(EROOR_QNAME)
>    .end();
>
> Message reached ACT_TYPE_SPECFIC_QNAME but it only checking when (
> .when(header(EVENT_TYPE).isEqualTo(ACT_TRANSACTION)) ) condition routing
> message to ACTIVATE_QNAME
>
> Filter not working property in this case.
>
> Please kindly help me
>
>
>
>
> On Wed, Sep 4, 2013 at 11:48 PM, Prabu <prabumca06@gmail.com> wrote:
>
> > Hi All,
> >
> > Camel i having code like this
> >
> > from(MESSAGING_TEST_CONSUMER_TYPE_SPECIFIC_QNAME).process(new
> > MemosProcess(*getContext().**createProducerTemplate()*))
> > .end();
> >
> > Above code worked fine in activemq 5.5 but after upgrade into active 5.8
> > it is not working.
> >
> > Message getting hang in MESSAGING_TEST_CONSUMER_TYPE_SPECIFIC_QNAME not
> > calling memosprocess class.
> >
> > Please kindly help me.
> >
> > *Thanks*
> > Prabu.N
> >
> >
> >
> > On Wed, Jul 24, 2013 at 11:49 PM, Christian Mueller [via Camel] <
> > ml-node+s465427n5736234h56@n5.nabble.com> wrote:
> >
> >> The test ensure it works:
> >>
> >> @Test
> >> public void testInOnlyJMSExpiration() throws Exception {
> >>     MockEndpoint mock = getMockEndpoint("mock:result");
> >>     mock.expectedMessageCount(1);
> >>
> >>     long ttl = System.currentTimeMillis() + 5000;
> >>
> >> template.sendBodyAndHeader("activemq:queue:bar?preserveMessageQos=true",
> >> "Hello World", "JMSExpiration", ttl);
> >>
> >>     // sleep just a little
> >>     Thread.sleep(2000);
> >>
> >>     // use timeout in case running on slow box
> >>     Exchange bar = consumer.receive("activemq:queue:bar", 10000);
> >>     assertNotNull("Should be a message on queue", bar);
> >>
> >>     template.send("activemq:queue:foo", bar);
> >>
> >>     assertMockEndpointsSatisfied();
> >> }
> >>
> >> @Test
> >> public void testInOnlyJMSExpirationNoMessage() throws Exception {
> >>     MockEndpoint mock = getMockEndpoint("mock:result");
> >>     mock.expectedMessageCount(1);
> >>
> >>     long ttl = System.currentTimeMillis() + 2000;
> >>
> >> template.sendBodyAndHeader("activemq:queue:bar?preserveMessageQos=true",
> >> "Hello World", "JMSExpiration", ttl);
> >>
> >>     // sleep more so the message is expired
> >>     Thread.sleep(5000);
> >>
> >>     Exchange bar = consumer.receiveNoWait("activemq:queue:bar");
> >>     assertNull("Should NOT be a message on queue", bar);
> >>
> >>     template.sendBody("activemq:queue:foo", "Hello World");
> >>
> >>     assertMockEndpointsSatisfied();
> >> }
> >>
> >> protected RouteBuilder createRouteBuilder() throws Exception {
> >>     return new RouteBuilder() {
> >>         public void configure() throws Exception {
> >>             from("activemq:queue:foo")
> >>                 .to("mock:result");
> >>         }
> >>     };
> >> }
> >>
> >> Check what you do differently...
> >>
> >> Best,
> >> Christian
> >> -----------------
> >>
> >> Software Integration Specialist
> >>
> >> Apache Camel committer: https://camel.apache.org/team
> >> V.P. Apache Camel: https://www.apache.org/foundation/
> >> Apache Member: https://www.apache.org/foundation/members.html
> >>
> >> https://www.linkedin.com/pub/christian-mueller/11/551/642
> >>
> >>
> >> On Wed, Jul 24, 2013 at 4:42 PM, [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5736234&i=0>
> >> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5736234&i=1
> >>wrote:
> >>
> >>
> >> > Hi Chris,
> >> >
> >> >  Thanks so much for the information.
> >> >
> >> > I have tried different property but it did not work.
> >> >
> >> > Please find my code below.
> >> >
> >> > *public static final String CONSUMER_TEST_QNAME     =
> >> >
> >> >
> >>
> "activemq:queue:ConsumerTestHandler?jmsMessageType=Text&preserveMessageQos=true";
> >>
> >> > *
> >> > *
> >> > *
> >> > *public static final String PRODUCER_TEST_QNAME     =
> >> >
> >> >
> >>
> "activemq:queue:ProducerTestHandler?jmsMessageType=Text&preserveMessageQos=true";
> >>
> >> > *
> >> > *    *
> >> > *public static final String
> MESSAGING_TEST_CONSUMER_TYPE_SPECIFIC_QNAME
> >>  =
> >> > "activemq:queue:Inbound.Memos.Consumer.Test";*
> >> > *
> >> > *
> >> > *public static final String
> MESSAGING_TEST_PRODUCER_TYPE_SPECIFIC_QNAME
> >>  =
> >> > "activemq:queue:Inbound.Memos.Producer.Test";*
> >> >
> >> >
> >> > from(*MESSAGING_TEST_CONSUMER_TYPE_SPECIFIC_QNAME*).process(new
> >> Processor()
> >> > {
> >> >      public void process(Exchange exchange) throws Exception {
> >> >
> >> >      }
> >> >          .setHeader(MEMOS_TARGET_SERVER,header(MASTER_HANDLER))
> >> >          .setHeader(JMSExpiration,constant(EXPIRY_TIME))
> >> >          .to(CONSUMER_TEST_QNAME)
> >> >          .setHeader(MEMOS_TARGET_SERVER, header(SLAVE_HANDLER))
> >> >          .setHeader(JMSExpiration,constant(EXPIRY_TIME))
> >> >          .to(CONSUMER_TEST_QNAME)
> >> >          .end();
> >> >
> >> > But,messages not expiring
> >> >
> >> > Please kindly help me
> >> >
> >> > *Thanks*
> >> > Prabu.N
> >> >
> >> >
> >> > On Wed, Jul 24, 2013 at 1:46 AM, Christian Mueller [via Camel] <
> >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5736234&i=2
> >>
> >> wrote:
> >> >
> >> > > It's not really so difficult to find an example, if you spend only
a
> >> few
> >> > > minutes:
> >> > >
> >> > >
> >> >
> >>
> https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob;f=components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerWithJMSHeaderTest.java;h=52b430b17a7ffc0ca977864ea8c6238050f90a57;hb=HEAD
> >> > >
> >> > > Best,
> >> > > Christian
> >> > > -----------------
> >> > >
> >> > > Software Integration Specialist
> >> > >
> >> > > Apache Camel committer: https://camel.apache.org/team
> >> > > V.P. Apache Camel: https://www.apache.org/foundation/
> >> > > Apache Member: https://www.apache.org/foundation/members.html
> >> > >
> >> > > https://www.linkedin.com/pub/christian-mueller/11/551/642
> >> > >
> >> > >
> >> > > ------------------------------
> >> > >  If you reply to this email, your message will be added to the
> >> discussion
> >> > > below:
> >> > >
> >> > >
> >> >
> >>
> http://camel.465427.n5.nabble.com/Camel-routing-issue-tp5730094p5736163.html
> >> > >  To unsubscribe from Camel routing issue, click here<
> >> >
> >> >
> >> > > .
> >> > > NAML<
> >> >
> >>
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >> > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > Thanks & Regards
> >> >  Prabu.N
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://camel.465427.n5.nabble.com/Camel-routing-issue-tp5730094p5736224.html
> >>
> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> >> discussion below:
> >>
> >>
> http://camel.465427.n5.nabble.com/Camel-routing-issue-tp5730094p5736234.html
> >>  To unsubscribe from Camel routing issue, click here<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5730094&code=cHJhYnVtY2EwNkBnbWFpbC5jb218NTczMDA5NHw4OTY0MTU3ODg=
> >
> >> .
> >> NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >>
> >
> >
> >
> > --
> > Thanks & Regards
> >  Prabu.N
> >
>
>
>
> --
> Thanks & Regards
>  Prabu.N
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-routing-issue-tp5730094p5741054.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message