Hi, ok, more or less got what was the problem (user mistake): I used SSH port forwarding on 61616 for the application/client to be able to connect to ActiveMQ (runs on a server that's hidden inside a private network). This does not work (of course) because ActiveMQ uses tcp sockets (at least I did in this case). I guess the confusing thing was that it was able to send messages to the ActiveMQ bus, that is why I did not assume a connection problem at first. Lesson learned, case closed!
Frank ________________________________________ Von: Quinn Stevenson [qu...@pronoia-solutions.com] Gesendet: Mittwoch, 30. November 2016 16:45 An: users@camel.apache.org Betreff: Re: How to use the InOut (Request-Reply) pattern in combination with REST/Jetty? Strange - the ActiveMQ configuration shouldn’t have anything to do with this. What versions of Camel and ActiveMQ are you using? I’ve had to use more/different URI options in the JMS URIs in older versions of Camel - I just don’t remember what they are right off hand. > On Nov 30, 2016, at 3:58 AM, Wein, Frank (RRZE) <frank.w...@fau.de> wrote: > > Hi all, > just a short update: It looks like I made a mistake on the activemq > configuration(?) itself, with an embedded ActiveMQ instance it seems to work > fine > ("ActiveMQComponent.activeMQComponent("vm://localhost?broker.persistent=false"));). > I will take a look at this then. Thanks for everyone who thought about this. > > Best regards > Frank > ________________________________________ > Von: Wein, Frank (RRZE) [frank.w...@fau.de] > Gesendet: Dienstag, 29. November 2016 21:49 > An: users@camel.apache.org > Betreff: AW: How to use the InOut (Request-Reply) pattern in combination with > REST/Jetty? > > Hi Claus, > unfortunately this still results in a the same error message (The OUT message > was not received...). > Route now looks like this, rest of the code stayed the same: > > rest("/API/") > .get("/object/{ID}/") > .to("direct:objectGet"); > > from("direct:objectGet").to(ExchangePattern.InOut, "activemq:test"); > > from("activemq:test").process(resultProcessor); > > The message history tells me: > RouteId ProcessorId Processor > Elapsed (ms) > [route1 ] [route1 ] > [jetty:http://0.0.0.0:8080/API/object/%7BID%7D?httpMethodRestrict=GET ] [ > 21035] > [route1 ] [restBinding1 ] [ > ] [ 6] > [route1 ] [route1 ] [direct:objectGet > ] [ 21019] > [route2 ] [to1 ] [activemq:test > ] [ 21018] > > So somehow the messages do not get fetched from the activemq bus, do I see > this correctly? Could this also be an ActiveMQ configuration problem? I'm a > little bit stuck at this point. > > Regards > Frank > ________________________________________ > Von: Claus Ibsen [claus.ib...@gmail.com] > Gesendet: Dienstag, 29. November 2016 18:49 > An: users@camel.apache.org > Betreff: Re: How to use the InOut (Request-Reply) pattern in combination with > REST/Jetty? > > Ah you need to break this up into two separate routes > > > from direct foo > to activemq test > > > from activemq test > process replyProcessor > > > On Tue, Nov 29, 2016 at 6:21 PM, Wein, Frank (RRZE) <frank.w...@fau.de> wrote: >> Hi, >> thanks for the link, unfortunately it still doesn't seem to work. The >> Exchange does not receive a reply message: >> "org.apache.camel.ExchangeTimedOutException: The OUT message was not >> received within: 20000 millis due reply message with correlationID: >> [...]-33309-1480438574020-0-3 not received on destination: >> temp-queue://ID:[...]-35217-1480438579489-1:1:1. >> Exchange[ID-[...]-33309-1480438574020-0-1]" >> >> The incoming messages on the ActiveMQ queue from the REST endpoint end up in >> the dead-letter queue: >> dlqDeliveryFailureCause java.lang.Throwable: Message Expired. >> Expiration:1480439266246 >> >> I tried quite a few things (inOut at different position in the route >> description, getIn, getOut, shared queue, ...), but nothing seems to work >> (always timeout waiting for the reply). Is it possible at all what I want to >> accomplish (reminder: Jetty REST endpoint passes message to queue, other >> route fetches from queue, modifies message and the original endpoint should >> reply with modified message). >> >> Is there a mistake in my current code? >> >> Processor resultProcessor = new Processor() { >> @Override >> public void process(Exchange exchange) throws Exception { >> exchange.getIn().setBody( "response"); >> return; >> } >> }; >> >> getContext().addComponent("activemq", >> ActiveMQComponent.activeMQComponent("tcp://localhost:61616")); >> >> >> restConfiguration().component("jetty").host("0.0.0.0").port(8080).dataFormatProperty("prettyPrint", >> "true"); >> >> rest("/API/").get("/object/{ID}/").to("direct:objectGet"); >> >> from("direct:objectGet").to(ExchangePattern.InOut, >> "activemq:test").process(resultProcessor).to("activemq:test"); >> >> >> Is my "to("activemq:test")" not the correct way to send back the modified >> message to the producer? Actually I thought the message exchange will >> automatically take care of sending back to the modified message body to the >> producer (doesn't seem to make a difference here anyway). >> >> >> Thanks for any suggestions! >> >> Frank >> >> ________________________________________ >> Von: Quinn Stevenson [qu...@pronoia-solutions.com] >> Gesendet: Montag, 28. November 2016 17:35 >> An: users@camel.apache.org >> Betreff: Re: How to use the InOut (Request-Reply) pattern in combination >> with REST/Jetty? >> >> Yes - this is possible. Look at "Request-Reply” in the JMS docs ( >> http://camel.apache.org/jms.html <http://camel.apache.org/jms.html> ). >> >> >>> On Nov 28, 2016, at 12:51 AM, Frank Wein <frank.w...@fau.de> wrote: >>> >>> Hi all, >>> some additional info/Java code: What I have currently working is some code >>> without the ActiveMQ part: >>> >>> restConfiguration().component("jetty").host("0.0.0.0").port(8080) >>> .dataFormatProperty("prettyPrint", "true") >>> .bindingMode(RestBindingMode.auto); >>> >>> rest("/API/").get("/object/{ID}/").to("direct:objectGet"); >>> >>> from("direct:objectGet") >>> .setExchangePattern(ExchangePattern.InOut) >>> .setHeader(Exchange.HTTP_PATH, simple( >>> "/Webservice/RESTService/Object/${header.ID}")) >>> .setHeader(Exchange.HTTP_METHOD, simple("GET")) >>> .to("jetty://http://localhost:8888?bridgeEndpoint=true"); >>> >>> I send my REST request to localhost:8080/object/[ID]/ and get back the >>> reply from the other webservice running on localhost:8888. >>> >>> Now, I want to include an ActiveMQ queue here. Basically the ActiveMQ queue >>> should be between the two routes (from/to("direct:objectGet")). The first >>> route should send the message to the queue, the second route should fetch >>> it, get the response from the other web service and send the response back >>> via the queue to the first route. This one should then reply to the >>> incoming REST request. Is this possible, if yes, how? My attempts at this >>> did not really work. >>> >>> Regards >>> Frank > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2