RE: Is it possible to communicate with a processor or component instance outside/independent of routing?

2021-10-25 Thread Steve Huston
Hi Steve,

Sure, you can do that. Your processor/component is just a Java class - you can 
do whatever you want. I wrote a component that encapsulated a bunch of external 
interactions that the "user" was not directly aware of.

There are lifecycle callbacks from Camel itself that can help you do the right 
thing on shutdown, etc.

-Steve

> -Original Message-
> From: Steve973 
> Sent: Monday, October 25, 2021 3:13 PM
> To: users 
> Subject: Is it possible to communicate with a processor or component
> instance outside/independent of routing?
> 
> Hello.  If I am implementing a new component or processor, is it possible to
> communicate with it for non-routing purposes?  For example, can a
> component or processor consume from a command-and-control
> direct/seda/etc queue?  It seems like it would be reasonable, but I would like
> to see if there is anything else within camel that does something similar.
> 
> Thanks,
> Steve


RE: .process vs .to(bean: ?

2021-09-10 Thread Steve Huston
You could also use something like cxfrs to do the REST call and have it 
unmarshal your JSON return.
That would make it easier to integrate with Mark's idea to use Camel's error 
handling and retries.

-Steve

> -Original Message-
> From: Mark Nuttall 
> Sent: Friday, September 10, 2021 3:51 PM
> To: users@camel.apache.org
> Subject: Re: .process vs .to(bean: ?
> 
> You should use the Camel Processing to do retries.
> 
> Also, look at using something like OpenFeign to reduce the boilerplate HTTP
> call. It can be very few lines of code.
> or you should use the Camel HTTP component.
> 
> 
> 
> On Fri, Sep 10, 2021 at 2:00 AM Matthee, Elmar [elm...@sun.ac.za] <
> elm...@sun.ac.za> wrote:
> 
> > Good morning all.
> >
> > I'm VERY new to camel so I'm still trying to get a grip on all the
> > various components so please bear with me.
> >
> > I'm using quarkus/camel and have a route where I pull a message off of
> > a kafka topic (this part works perfectly btw) but then I want to send
> > the string on to a REST service and based on the response I get back
> > from the service (i.e. 200 - Ok - Go on to next message, 400 - Bad
> > Request - throw message in an error queue or 503 - Service unavailable
> > - Wait x amount of time and do y amounts of retries before stopping the
> route completely).
> >
> > My first attempt was to do all the REST calls in a .proccess java class.
> >
> > But I now saw that you can do a .to(bean:xxx) and basically also call
> > a java class to do all the required code etc.
> >
> > So my question is: what is the more "correct" way to do this
> > (especially with regards to getting application.properties values to
> > the java class and then sending/handeling the responses from the REST
> > service. Would it be better to do all the error/wait handeling in the
> > java class or rather build it into the route itself (with
> > .errorHandler etc?)
> >
> > Here is my current working route code:
> >
> > @ApplicationScoped
> > public class EnrollementEventRoute extends RouteBuilder {
> > private EnrollmentEventRestSender eers;
> >
> > @ConfigProperty(name = "kafka.topic.academia.registration")
> > String registrationTopicName;
> >
> > @ConfigProperty(name = "kafka.academia.broker")
> > String kafkaBroker;
> >
> > @ConfigProperty(name = "kafka.academia.config.clientId")
> > String kafkaClientId;
> >
> > @ConfigProperty(name =
> > "kafka.academia.registration.autoOffsetReset",
> > defaultValue = "latest")
> > String offset;
> >
> > @ConfigProperty(name = "kafka.academia.config.groupId")
> > String groupId;
> >
> > @ConfigProperty(name = "kafka.academia.config.keyDeserializer")
> > String keyDeserializer;
> >
> > @ConfigProperty(name = "kafka.academia.config.valueDeserializer")
> > String valueDeserializer;
> >
> > @ConfigProperty(name = "fms.registration.restservice.endpoint")
> > String restEndpoint;
> >
> > @Override
> > public void configure() throws Exception {
> > eers = new EnrollmentEventRestSender(restEndpoint);
> > from(kafka(registrationTopicName)
> > .brokers(kafkaBroker)
> > .clientId(kafkaClientId)
> > .groupId(groupId)
> > .keyDeserializer(keyDeserializer)
> > .valueDeserializer(valueDeserializer)
> > .autoOffsetReset(offset))
> > .log("Registration Event received: ${body}")
> > .process(eers);
> >
> > }
> >
> > And then here is the code in the EnrollmentEventRestSender class:
> >
> > @ApplicationScoped
> > public class EnrollmentEventRestSender implements Processor {
> >   private String restEndpoint;
> >
> > public EnrollmentEventRestSender() {  //Dummy constructor needed.
> >
> > };
> >
> > public EnrollmentEventRestSender(String url) {
> >   this.restEndpoint = url;
> > }
> >
> >
> >
> > @Override
> > public void process(Exchange exchange) throws Exception {
> > try {
> >   CloseableHttpClient client = HttpClients.createDefault();
> >   System.out.println("Got endpoint of: " + restEndpoint);
> >   HttpPost httpPost = new HttpPost(restEndpoint);
> >   String json = (String) exchange.getIn().getBody();
> >   System.out.println("Got JSON in Exchange: " + json);
> >   StringEntity entity = new StringEntity(json);
> >   httpPost.setEntity(entity);
> >  // httpPost.setHeader("Accept", "application/json");
> >   httpPost.setHeader("Content-type", "text/plain; charset=utf-8");
> >   CloseableHttpResponse response = client.execute(httpPost);
> >   System.out.println("Got Response of: " +
> > response.getStatusLine().getStatusCode());
> >   if (!(response.getStatusLine().getStatusCode()==200)) { //
> > Something wrong
> > InputStream is = response.getEntity().getContent();
> > BufferedReader rd = new 

Setting kafka client ID

2021-08-18 Thread Steve Huston
I am using Camel 3.7.4 and have a route that sends data to Kafka. I am trying 
to add the clientID parameter to it and getting the following error message:

org.apache.camel.FailedToCreateRouteException: Failed to create route 
outgoingMessageRoute at: >>> 
To[kafka:{{historian.topic}}?clientId=stage-outgoing-history] <<< in route: 
Route(outgoingMessageRoute)[From[seda:risOut] -> [OnExceptio... because of 
Failed to resolve endpoint: kafka://unused?clientId=stage-outgoing-history due 
to: Failed to resolve endpoint: kafka://unused?clientId=stage-outgoing-history 
due to: There are 1 parameters that couldn't be set on the endpoint. Check the 
uri if the parameters are spelt correctly and that they are properties of the 
endpoint. Unknown parameters=[{clientId=stage-outgoing-history}]
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve 
endpoint: kafka://unused?clientId=stage-outgoing-history due to: Failed to 
resolve endpoint: kafka://unused?clientId=stage-outgoing-history due to: There 
are 1 parameters that couldn't be set on the endpoint. Check the uri if the 
parameters are spelt correctly and that they are properties of the endpoint. 
Unknown parameters=[{clientId=stage-outgoing-history}]
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve 
endpoint: kafka://unused?clientId=stage-outgoing-history due to: There are 1 
parameters that couldn't be set on the endpoint. Check the uri if the 
parameters are spelt correctly and that they are properties of the endpoint. 
Unknown parameters=[{clientId=stage-outgoing-history}]

Without the added clientId parameter it works. I assume I'm missing something 
obvious but I'm not seeing it. Could someone please help me with this?

Thank you,
-Steve


RE: How to adviceWith in Camel 3.10 ?

2021-06-24 Thread Steve Huston
I got stuck on the same point... there is a good explanation in the Camel 3 
migration guide: 
https://camel.apache.org/manual/latest/camel-3-migration-guide.html

Search for "advice" in that page.

-Steve

> -Original Message-
> From: mail4...@gmail.com 
> Sent: Thursday, June 24, 2021 2:23 AM
> To: users@camel.apache.org
> Subject: How to adviceWith in Camel 3.10 ?
> 
> Hello.
> 
> Seems it is unable to adviceWith route definitions in Camel 3.10 anymore.
> Isn't it?
> 
> My project is SpringBoot project with dependensies:
> - camel-spring-boot-starter:3.10.0,
> - spring-boot-starter-test,
> - camel-test-spring-junit5:3.10.0
> 
> I got stuck on writing my test.
> My intention is to skip original endpoint and to use mock instead of it.
> I have already tried several approaches to implement a test and my last test
> looks like:
> 
> @ActiveProfiles("test")
> @CamelSpringBootTest
> @ContextConfiguration(classes = SpreingBootApplication.class)
> @MockEndpoints("direct://" + QUEUE_CARD_ISSUED_NOTIFICATION)
> @UseAdviceWith public class CardIssuingTest extends CamelTestSupport {
> // ...
> }
> 
> 
> But when I do
> 
> context.getRouteTemplateDefinition("my-route")
> 
> it returns a RouteDefinition object that does not provide adviceWith()
> method.
> 
> So...
> How to adviceWith? What is the latest approach to test application with
> SpringBoot, Camel, JUnit5?
> 
> 
> _
> Vyacheslav Boyko,
> mailto:mail4...@gmail.com



RE: Need to ACK messages before end of route

2021-04-20 Thread Steve Huston
Is the Process1 -> Processor2 route logically separate from Processor3 -> 
Processor4? If yes, put them in separate routes. Mark the "put on Google 
PubSub" InOnly then it won't wait for a reply.
-Steve

> -Original Message-
> From: David Shubert 
> Sent: Tuesday, April 20, 2021 11:20 AM
> To: users@camel.apache.org
> Subject: Need to ACK messages before end of route
> 
> Hello
> 
> I have Camel routes that look like this:
> 
> Processor1->Processor2->Processor3->Processor4
> 
> Processor1 does some business logic.
> Processor2 puts a message on Google PubSub.
> Processor3 takes the message from Google PubSub.
> Processor4 uses info from the message to do things.
> 
> My problem is that Camel doesn't ACK the message until Processor4
> successfully completes. So if Processor4 throws an exception the message is
> redelivered endlessly. This is not what I want.
> 
> Is there a way to tell Camel to ACK the message in Processor3 so that it won't
> be redelivered?
> 
> Thanks,
> David
> 
> --
> This email message is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. Any unauthorized review,
> use, disclosure or distribution is prohibited. If you are not the intended
> recipient, please contact the sender by reply email and destroy all copies of
> the original message.


Re: own endpoint exmaple?

2019-09-16 Thread Steve Huston
Is it possible that Spring is not finding your endpoint class?

-Steve

On 9/16/19, 6:55 AM, "thomas.thi...@telekom.de"  
wrote:

Hi Alex,

1. I found this webpage but the links (e.g. createProducer()) goes to "page 
not found".

2. Stupid question: how and where to do this? 

-Ursprüngliche Nachricht-
Von: Alex Dettinger  
Gesendet: Montag, 16. September 2019 12:52
An: users@camel.apache.org
Betreff: Re: own endpoint exmaple?

Hi Thomas,

  This link might be of interest:
  https://camel.apache.org/manual/latest/writing-components.html

  In your case, I wonder if you missed to create the thomas component first.

hth,
Alex

On Mon, Sep 16, 2019 at 12:44 PM  wrote:

> Hi,
>
> can some point me to a working example where an own endpoint was created.
>
> In route I say:
>
> .to("thomas://foo")
>
> my Endpoint is
>
> @Component
> @UriEndpoint(scheme = "thomas", title = "Thiele", 
> syntax="thomas:name", label = "Thomas") public class ThomasStep 
> extends DefaultEndpoint {}
>
> But I get.
>
> thomas://name due to: No component found with scheme: thomas
>




RE: How to use simple expression in properties file?

2019-06-27 Thread Steve Huston
Perfect - thank you!!!

> -Original Message-
> From: Claus Ibsen 
> Sent: Thursday, June 27, 2019 1:00 PM
> To: users@camel.apache.org
> Subject: Re: How to use simple expression in properties file?
> 
> Hi
> 
> Yeah use $simple{header.xxx}
> 
> On Thu, Jun 27, 2019 at 4:55 PM Steve Huston 
> wrote:
> >
> > Thank you for clarifying that the string for toD is already a simple string.
> However, it still fails with the same exception at runtime:
> >
> > Caused by: java.lang.IllegalArgumentException: Could not resolve
> placeholder 'header.SMID' in value "file://.?fileName=status-
> ${header.SMID}.txt"
> >
> > -Steve
> >
> > > -Original Message-
> > > From: Claus Ibsen 
> > > Sent: Wednesday, June 26, 2019 11:41 PM
> > > To: users@camel.apache.org
> > > Subject: Re: How to use simple expression in properties file?
> > >
> > > On Wed, Jun 26, 2019 at 11:49 PM Steve Huston
> 
> > > wrote:
> > > >
> > > > Is it possible to put a simple() expression in a properties string and 
> > > > have
> > > Camel evaluate it at run time?
> > > >
> > > > Here's what I'm trying to do:
> > > > - Set a message header ID with a value I want to use later
> > > > - Use .toD("{{event.sink}}")
> > > >
> > > > application.properties can then have something like:
> > > >
> > > > event.sink = simple("file://.?fileName=status-${header.ID}.txt")
> > > >
> > >
> > > toD using a string is simple language already, so just use
> > >
> > > event.sink = file://.?fileName=status-${header.ID}.txt
> > >
> > > > The goal being to have a message body written to a file whose name
> > > includes the ID header value.
> > > >
> > > > When I try to run this I get an exception:
> > > >
> > > > Caused by: java.lang.IllegalArgumentException: Could not resolve
> > > placeholder 'header.ID' in value "simple("file://.?fileName=status-
> > > ${header.ID}.txt")"
> > > >
> > >
> > > And you can use $simple{xxx} syntax for the fileName value
> > >
> > >
> > >
> > > > Thanks,
> > > > -Steve
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> 
> 
> 
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


RE: How to use simple expression in properties file?

2019-06-27 Thread Steve Huston
Thank you for clarifying that the string for toD is already a simple string. 
However, it still fails with the same exception at runtime:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 
'header.SMID' in value "file://.?fileName=status-${header.SMID}.txt"

-Steve

> -Original Message-
> From: Claus Ibsen 
> Sent: Wednesday, June 26, 2019 11:41 PM
> To: users@camel.apache.org
> Subject: Re: How to use simple expression in properties file?
> 
> On Wed, Jun 26, 2019 at 11:49 PM Steve Huston 
> wrote:
> >
> > Is it possible to put a simple() expression in a properties string and have
> Camel evaluate it at run time?
> >
> > Here's what I'm trying to do:
> > - Set a message header ID with a value I want to use later
> > - Use .toD("{{event.sink}}")
> >
> > application.properties can then have something like:
> >
> > event.sink = simple("file://.?fileName=status-${header.ID}.txt")
> >
> 
> toD using a string is simple language already, so just use
> 
> event.sink = file://.?fileName=status-${header.ID}.txt
> 
> > The goal being to have a message body written to a file whose name
> includes the ID header value.
> >
> > When I try to run this I get an exception:
> >
> > Caused by: java.lang.IllegalArgumentException: Could not resolve
> placeholder 'header.ID' in value "simple("file://.?fileName=status-
> ${header.ID}.txt")"
> >
> 
> And you can use $simple{xxx} syntax for the fileName value
> 
> 
> 
> > Thanks,
> > -Steve
> 
> 
> 
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


How to use simple expression in properties file?

2019-06-26 Thread Steve Huston
Is it possible to put a simple() expression in a properties string and have 
Camel evaluate it at run time?

Here's what I'm trying to do:
- Set a message header ID with a value I want to use later
- Use .toD("{{event.sink}}")

application.properties can then have something like:

event.sink = simple("file://.?fileName=status-${header.ID}.txt")

The goal being to have a message body written to a file whose name includes the 
ID header value.

When I try to run this I get an exception:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 
'header.ID' in value "simple("file://.?fileName=status-${header.ID}.txt")"

Thanks,
-Steve


RE: activemq-camel: accessing a javax.jms StringProperty ?

2019-05-21 Thread Steve Huston
Camel JMS transfers JMS properties to Camel message headers.
https://stackoverflow.com/questions/22561717/camel-adding-properties-to-a-message-in-spring-dsl
So check exchange.getIn().getHeader(...) in your processor.

-Steve

> -Original Message-
> From: Marx, Peter 
> Sent: Tuesday, May 21, 2019 9:10 AM
> To: users@camel.apache.org
> Subject: activemq-camel: accessing a javax.jms StringProperty ?
> 
> i route jms messages to a processor:
> 
> from("amq:ddbqueue")
> .process("convert")
>  .to(...)
> 
> The messages have properties which were set on producer side with e.g.
> 
> message.setStringProperty("myprop", "myvalue"); //message is of type
> javax.jms
> 
> I want to pick up the property in the Processor and set the Exchange header
> field CamelFileName with the content of the myprop property.
> 
> But I can't find a way to apply something like
> 
> javax.jms.Message inMessage= (org.apache.camel.Message)
> exchange.getIn();  // cast not possible
> 
> String prop = inMessage.getStringProperty("myprop");   // as 
> only
> javax.jms does have the getStringProperty method
> 
> org.apache.camel.Message outMessage=exchange.getOut();
> 
> outMessage.setHeader("CamelFileName",zipFileName);
> 
> 
> Is there a way to access the jms properties ?
> 
> Peter
> 
> 
> 
> Knorr-Bremse Systeme für Schienenfahrzeuge GmbH
> Sitz: München
> Geschäftsführer: Dr. Jürgen Wilder (Vorsitzender), Mark Cleobury, Dr.
> Nicolas Lange, Dr. Peter Radina, Harald Schneider Registergericht München,
> HR B 91 181
> 
> This transmission is intended solely for the addressee and contains
> confidential information.
> If you are not the intended recipient, please immediately inform the sender
> and delete the message and any attachments from your system.
> Furthermore, please do not copy the message or disclose the contents to
> anyone unless agreed otherwise. To the extent permitted by law we shall in
> no way be liable for any damages, whatever their nature, arising out of
> transmission failures, viruses, external influence, delays and the like.



Re: Issue with JMSReplyTo

2019-04-16 Thread Steve Huston
I'm not sure I understand what your statement is saying, but I think that if 
you set the exchange to InOnly when it is received, the ReplyTo will not affect 
it.

-Steve

On 4/16/19, 7:58 AM, "sagheer ahmed"  wrote:

Hi Team,

Just looking for some help with the below issue. Please do the needful.

*Problem statement:*
Spring boot service with apache camel consumer on IBM MQ. The route
receives the request, does some processing and sends it to another queue.
When the client sends a message without *JMSReplyTo* set in the header, the
message goes to the 'to' endpoint. If it comes with *JMSReplyTo*, I get the
below error:

*org.springframework.jms.IllegalStateException: JMSWMQ2007: Failed to send
a message to destination ‘TEST.OWL.REQ.01'.; nested exception is
com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ2007: Failed to
send a message to destination 'TEST.OWL.REQ.01'.*

*JMS attempted to perform an MQPUT or MQPUT1; however WebSphere MQ reported
an error.*

*Use the linked exception to determine the cause of this error.; nested
exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed
with compcode '2' ('MQCC_FAILED') reason '2027'
('MQRC_MISSING_REPLY_TO_Q').*

*Versions: *
Springboot - 1.5.1.RELEASE
Camel - 2.21.0
IBM MQ - 9.0.x

*Analysis:*
When msg comes without *JMSReplyTo* - *JMS_IBM_MsgType=8* & with
*JMSReplyTo* - *JMS_IBM_MsgType=1. *I understood that the initial value is
MQMT_DATAGRAM & with replyTo queue it changes to MQMT_REQUEST
If I change this header value to 1, it behaves as expected. How do I do it
without touching the headers? I tried disableReplyTo option in 'from' of
the route but that doesn't help.


Regards,
Sagheer




RE: [FEEDBACK] - Apache Camel 3 - camel-core vs camel-core-lite vs camel-core-all

2019-03-05 Thread Steve Huston
My assumption is that camel-core (all in one) doesn't have any negative affect 
on Camel itself and that breaking it up is motivated by a benefit to those 
projects that want to reduce size.

If that is true, then I recommend leaving camel-core as it is in 2.x - that 
reduces surprises to all users and prevents a huge bunch of "hey, you broke my 
app in 3.0" emails to the list. Those applications that want to reduce size can 
make some simple dependency changes.

As a more personal preference, please don't call anything "-lite" - it is way 
overused and smacks of "cheap, crappy alternative to the real one." Call it 
camel-base or camel-minimal.

-Steve

> -Original Message-
> From: Claus Ibsen 
> Sent: Tuesday, March 05, 2019 3:49 AM
> To: users@camel.apache.org
> Subject: [FEEDBACK] - Apache Camel 3 - camel-core vs camel-core-lite vs
> camel-core-all
> 
> Hi
> 
> As you may know Apache Camel 3 development is underway, and part of the
> work is to modularize camel-core into smaller modules, where the major
> work has been done for the M1 release. This means that 95% of the core
> components from camel-core has been moved out, eg camel-log, camel-
> seda, camel-direct etc.
> 
> Now we want to have a camel-core dependency that are tiny and would like
> feedback on different styles
> 
> 1)
> Keep camel-core dependency as in Camel 2.x which has dependency on all
> the core components (known as camel-core-all) AND introduce a new camel-
> core-lite that has minimal dependencies so you can pick and choose only the
> dependencies you need.
> 
> 2)
> Keep camel-core as a lite dependency and introduce a new camel-core-all
> that has all the core components and is similar to camel 2.x. This means that
> users would need to migrate from using camel-core => camel-core-all OR add
> only the extra core components they use, eg camel-direct, camel-seda, etc.
> 
> 3)
> Do #1 and move towards #2 in the future.
> 
> We can add a new camel-core-all dependency that has all the core
> components etc, and then let camel-core depend on this dependency. And
> then we can also add the camel-core-lite module as well. Then if we one day
> switch camel-core from the ALL to the LITE style, we can do that out of the
> box, for example for Camel 4 ;)
> 
> Note: One issue with the name camel-core-all is that it smells like it has 
> all the
> core modules, but it will not include camel-core-osgi or camel-core-xml as
> they are only needed when you add camel-spring or camel-blueprint (for
> XML and/or OSGi support).
> 
> Well just thinking out loud a bit, here in the morning after a couple of cup 
> of
> coffees.
> 
> Any thoughts and feedback is much welcome.
> 
> 
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


RE: [DISCUSS] - Apache Camel 3 - A new tagline

2019-02-19 Thread Steve Huston
"Integrate everything!"

> -Original Message-
> From: Claus Ibsen 
> Sent: Tuesday, February 19, 2019 10:52 AM
> To: users@camel.apache.org
> Subject: [DISCUSS] - Apache Camel 3 - A new tagline
> 
> Hi
> 
> As part of Apache Camel 3, we are working on a new modern website (yeah
> its long overdue, but work are in progress).
> 
> As part of that, we should get a new front-page with a new short summary
> what Apache Camel is (eg a tagline).
> 
> It would be good to get some ideas rolling what such a tagline could be and
> for users of Camel to come up with suggestions.
> 
> As Apache Camel has been around for so long, and that it covers so many
> different use-cases, then its maybe harder to come up with a single tag-line
> that spans all use-cases.
> 
> However with the new modern world of containers I came up with:
> 
> * Apache Camel 3 - A full-stack integration framework for building cloud-
> native micro integrations
> 
> 
> 
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


RE: understanding InOut

2018-12-14 Thread Steve Huston
> and how does the starting point react on the exchange it receives from the
> end?

Generically, it acts as thought it was the subject of a 'to' at the end. The 
exact behavior is probably documented in the endpoint reference info. For 
example, the page I referenced below discusses how JMS handles it.

> What if the end produces multiple exchanges?

You've exceeded my knowledge on this... sorry.

> Steve Huston  writes:
> 
> > I have also found it a bit difficult to get a straight answer on this
> > but my understanding at this point is that if the exchange gets to the
> > end of the route and is an InOut, the Out from the last endpoint goes
> > back to the 'from' starting point.
> >
> > http://camel.apache.org/request-reply.html
> >
> > -Steve
> >
> >> -Original Message-
> >> From: Peter Nagy (Jr) 
> >> Sent: Friday, December 14, 2018 10:27 AM
> >> To: users@camel.apache.org
> >> Subject: understanding InOut
> >>
> >> I still don't quite grok how InOut works. When I set the exchange
> >> pattern to InOut, what exactly will happen? Will the *next* processor
> >> reply to the previous one? If so, how? If so, how does the previous
> >> processor act on the reply? Or is the InOut just about 1 Processor?
> >> If so, can e.g.
> >> a Processor block
> >> until a split is reaggregated?
> >>
> >> I'm trying to find some documentation on this that would explain
> >> these details but I didn't find much. The request-reply page is brief
> >> and uses mocks.
> >>
> >> As a real world bonus - I'm running a mongodb aggregation pipeline
> >> splitting and streaming and would need to fire just 1 exchange
> >> further down the route when the whole aggregation is finished. I'm
> >> doing
> >>
> >>   .to("mongodb3://...")
> >>   .split(..).streaming()
> >>   ...
> >>   .aggregate(..)
> >>   .hereINeed1exchange;
> >>
> >> I recently found out that split can take an aggregator as argument,
> >> would that solve this case? How exactly does that work?
> >>
> >> --
> >> To reach a goal one has to enjoy the journey.
> 
> 
> --
> To reach a goal one has to enjoy the journey.


RE: understanding InOut

2018-12-14 Thread Steve Huston
I have also found it a bit difficult to get a straight answer on this but my 
understanding at this point is that if the exchange gets to the end of the 
route and is an InOut, the Out from the last endpoint goes back to the 'from' 
starting point.

http://camel.apache.org/request-reply.html

-Steve

> -Original Message-
> From: Peter Nagy (Jr) 
> Sent: Friday, December 14, 2018 10:27 AM
> To: users@camel.apache.org
> Subject: understanding InOut
> 
> I still don't quite grok how InOut works. When I set the exchange pattern to
> InOut, what exactly will happen? Will the *next* processor reply to the
> previous one? If so, how? If so, how does the previous processor act on the
> reply? Or is the InOut just about 1 Processor? If so, can e.g. a Processor 
> block
> until a split is reaggregated?
> 
> I'm trying to find some documentation on this that would explain these
> details but I didn't find much. The request-reply page is brief and uses 
> mocks.
> 
> As a real world bonus - I'm running a mongodb aggregation pipeline splitting
> and streaming and would need to fire just 1 exchange further down the
> route when the whole aggregation is finished. I'm doing
> 
>   .to("mongodb3://...")
>   .split(..).streaming()
>   ...
>   .aggregate(..)
>   .hereINeed1exchange;
> 
> I recently found out that split can take an aggregator as argument, would that
> solve this case? How exactly does that work?
> 
> --
> To reach a goal one has to enjoy the journey.


RE: virtual connections

2018-01-24 Thread Steve Huston
Hi Paul,

I'd like to clarify a few things that are not clear to me from your message.

- Is this a reference to ActiveMQ broker network? I'm guessing form the 
terminology and port numbers that it is.
- Is there a way you could assign the "old" names (possibly as secondary names) 
to the new hosts when you upgrade hardware?
- I'm not aware of Camel having built-in clustering and load balancing - do you 
mean something else?

As for your "hide it behind a load balancer or VIP" idea, yes, that could work. 
I have a system deployed that does just that, in OpenShift using haproxy to 
balance over the broker instances.

Please reply with more info if I've misunderstood your questions/statements.

-Steve

> -Original Message-
> From: Paul Mena [mailto:pm...@constantcontact.com]
> Sent: Wednesday, January 24, 2018 2:28 PM
> To: users@camel.apache.org
> Subject: virtual connections
> 
> In my workplace's production Camel environment, we utilize 3 master-slave
> pairs running Camel version 2.9.2. Producers and Consumers reference these
> servers by hardcoded hostname in
> 
> consumer-camel-context.xml and producer-camel-context.xml. An example
> the latter might be:
> 
> 
> 
> 
> We run into issues with the above when we migrate to new hardware and
> change the server names. This requires not only a change to the XML files
> (maintained in puppet), but also a deployment of the producing and
> consuming applications to pick up the updated configuration. What we'd like
> to do instead is to virtualize the connection behind either an F5 load 
> balancer
> or a Virtual IP address. Ideally it would look something like this:
> 
> 
> 
> ...or something like that. Is a scheme like this even possible given the 
> built-in
> clustering and load balancing in Camel?
> 
> Thanks in advance.
> 
> --
> *Paul David Mena*
> Senior Software Engineer
> Engineering Services


RE: Camel REST Spring Boot Pojo Mandatory Json Properties

2017-12-12 Thread Steve Huston
I don't have a REST-specific example to show you, but in other scenarios I've 
done, after unmarshalling to POJO:

.to("bean-validator://validate-request")

If the validator annotations find a violation an exception will be thrown.

-Steve

> -Original Message-
> From: Richard James [mailto:richiejame...@gmail.com]
> Sent: Tuesday, December 12, 2017 1:19 PM
> To: users@camel.apache.org
> Subject: Camel REST Spring Boot Pojo Mandatory Json Properties
> 
> Hi,
> 
> I am in the process of implementing a REST Api using Spring boot and Camel.
> This is up and running and works well.
> 
> What I am currently trying to enforce are some mandatory properties within
> the POJO/JSON. I have attempted a number of different ways including using
> bean validator (@NotNull) as well as Jackson annotations
> (@JsonProperty((value = "departmentCode", required=true). However a call
> to the API without one of the mandatory fields works without throwing any
> error.
> 
> The one way I have got it to work is by putting a check in the
> getDepartmentCode method for a null value which then throws a custom
> exception that I have created. I'm not sure if this is the best way to do it.
> 
> if (departmentCode!= null) {
> return departmentCode;
> } else {
> throw new CustomJSONException("Department code is a required field"); }
> 
> My rest dsl looks like the following;
> 
> rest("").bindingMode(RestBindingMode.json).consumes("application/json")
> .produces("application/json")
> .post("jobcompletionevent").type(Job.class).outType(String.class).enableCO
> RS(true)
> .description("Adds a job ").id("AddJob").responseMessage().code(400)
> .message("Invalid JSON
> Request").endResponseMessage().responseMessage().code(200)
> .message("Valid Request
> Received").endResponseMessage().to("direct:jobEventDistributor");
> 
> Can anyone point me in the right direction of how I should aim to handle this
> use case? Should this be done in the initial binding or as an extra step
> afterwards. Any pointers are much appreciated.
> 
> Regards,
> Richard


PropertyInject defaultValue doesn't work with zero-length string

2017-11-07 Thread Steve Huston
I am using Camel 2.19.1 and have a question on @PropertyInject with a default 
value. I have the following:

public class MyStuff {
@PropertyInject(value="testVal", defaultValue="")
private String testVal;
...
}

When this class is instantiated and injected, if there is no 'testVal" in 
properties, I get an exception (below) that the testVal key is not found.

But if I change the defaultValue to anything non-empty, it works fine - the 
default value is used without a property of the given name.

Is this the way you would expect it to work?

Thanks,
-Steve

...
Caused by: org.apache.camel.RuntimeCamelException: 
java.lang.IllegalArgumentException: Property with key [testVal] not found in 
properties from text: {{testVal}}
at 
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1774)
at 
org.apache.camel.impl.CamelPostProcessorHelper.getInjectionPropertyValue(CamelPostProcessorHelper.java:282)
at 
org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFieldProperty(DefaultCamelBeanPostProcessor.java:211)
at 
org.apache.camel.impl.DefaultCamelBeanPostProcessor$1.doWith(DefaultCamelBeanPostProcessor.java:171)
at 
org.apache.camel.util.ReflectionHelper.doWithFields(ReflectionHelper.java:74)
at 
org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFields(DefaultCamelBeanPostProcessor.java:167)
at 
org.apache.camel.impl.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:82)
at 
org.apache.camel.impl.DefaultInjector.newInstance(DefaultInjector.java:48)
... 61 more
Caused by: java.lang.IllegalArgumentException: Property with key [ris.testOpk] 
not found in properties from text: {{ris.testOpk}}
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:271)
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:157)
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:116)
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:100)
at 
org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:63)
at 
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:230)
at 
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:173)
at 
org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:2411)
at 
org.apache.camel.impl.CamelPostProcessorHelper.getInjectionPropertyValue(CamelPostProcessorHelper.java:268)
... 67 more



RE: One-way handler processing

2017-10-19 Thread Steve Huston
I'm not a super expert in this area, but since you are building a @Component 
you could maybe use the async capability of Camel processors.

There's a decent explanation and example in the Camel in Action 2nd edition.

-Steve

> -Original Message-
> From: Robson Vargas Farias [mailto:robsonvargasfar...@gmail.com]
> Sent: Thursday, October 19, 2017 7:44 PM
> To: users@camel.apache.org
> Subject: One-way handler processing
> 
> hey guys, I'm facing an issue using @Handler.
> 
> Currently I've a route that get messages from a MQ and send to a bean
> annotated with @Handler, this bean instantiate a new Spring prototype bean
> (programatically) and process the message - just to have the processing
> happening in a different thread and avoid conflicts among multiple queues
> accessing this handler bean, that´s generic.
> 
> The issue happens with the throttle configuration, that is not working
> properly, because the thread is released only when the Handler completes
> its processing.
> 
> My idea is turn this processing asynchronous using Spring's @Async, but I'd
> like to hear from you if there´s any other "Camel" way idea to use in place?
> 
> My bean is like:
> 
> @Component("processor_handler_endpoint")
> class MyBean {
> 
>@Handler
>method(Exchange e) {
>   SpringFactory.createNewPrototypeOf(ProcessorClass.class).process(e);
>}
> 
> }
> 
> My route is like:
> 
> 
> 
>  autoStartup="{{MyQueue_config.queue.enabled}}">
>   timePeriodMillis="1000">
> ${properties:MyQueue_config.throttle.request_per_second
> }
> 
> ${properties:MyQueue_config.header.feed_staging_type_id
> .value}
> 
> 
>  
> 


Re: Apache Camel Routing: Best practice how to poll an external REST API

2017-08-08 Thread Steve Huston
I don’t have example code readily available, but one possible approach would be:

- Send job request REST/JSON and get job ID back
- Add ID to a queue of not-yet-done jobs
- A separate route pulls job IDs from the not-done queue and polls
- If not done, put it back on the queue
- If done, put ID on a different queue for done jobs
- A third route pulls job IDs from the done queue and retrieves the search 
result

You’d want some delay or use a timer in combination with the not-done job queue.

-Steve

> On Aug 8, 2017, at 4:12 AM, simon_dietschi  wrote:
> 
> Hi Camel folks,
> 
> I am currently looking for a simple approach achieving the following in
> Apache Camel / Spring Boot:
> 
> 1. Send a search job request to an external REST/JSON API
> 2. Get a search processing job ID from the API
> 3. Poll the API until it returns a JSON response containing a specific
> status = done
> 4. Once status done has been returned, proceed with the retrieval of the
> search result (separate part, considered to be straight forward)
> 
> The first solution one may think of is to implement the Polling Consumer
> pattern, which in my opinion requires too much overhead code (need to
> implement Component, Endpoint, Consumer,...) and more important this pattern
> does the contrary - it returns a message once a message is available (e.g.
> https://github.com/Palo-IT/Examples/tree/master/camel-custom-feedly-component).
> 
> Another approach would be a simple Processor where I loop a defined number
> of times calling the API or using the DSL -> doWhile...
> 
> As I was unable to find a good code snippet, it would be cool if you guys
> can share your thoughts or point me to a good sample.
> 
> Cheers,
> Simon
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-Routing-Best-practice-how-to-poll-an-external-REST-API-tp5809926.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



RE: Apache camel restarting the route

2017-06-16 Thread Steve Huston
The only concept you're missing is that 'from' is not a one shot event. The 
route keeps running, taking whatever messages become available from the source 
queue.

-Steve

> -Original Message-
> From: Mahesha999 [mailto:abnav...@gmail.com]
> Sent: Friday, June 16, 2017 10:19 AM
> To: users@camel.apache.org
> Subject: Apache camel restarting the route
> 
> 
> 
> I have a something as following:
> 
> from("rabbitmq://...")
>  .process(processor1)
> :
>  .process(processorn)
>  .process(SendToExternalAppProcessor)
> 
> The SendToExternalAppProcessor.process() uses producer template to send
> the some request formed from the contents in the exchange parameter to
> another
> rabbitmq2 with sendBody() method.
> 
> The issue is that once SendToExternalAppProcessor.process() executes and
> above route executes, it restarts above route again along with the listener of
> the rabbitmq2.
> 
> What I am missing here? Is there any apache camel configuration that is
> slipping from my attention?
> 
> Also I tried by commenting sendBody() and still restarts the route. I must be
> missing something weird basic setting here...
> 
> *PS:* I know I have not given any concrete code here so as to replicate the
> scenario on your machine, but am in hope that experienced head and eyes
> will be quick to recall and suggest something. (Also I cannot straightway 
> share
> my project code and also its big and complex)
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-
> camel-restarting-the-route-tp5804637.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: How to Extract json key, value from MQTT payload

2017-06-06 Thread Steve Huston
That depends totally on what MyProcessor does with the data and where it puts 
it.

> -Original Message-
> From: solomon [mailto:austin.solomon...@gmail.com]
> Sent: Tuesday, June 06, 2017 8:21 AM
> To: users@camel.apache.org
> Subject: How to Extract json key, value from MQTT payload
> 
> Hi,
> 
> I have created a camel route of mqtt -> jdbc which pushes the data in json
> format into MQTT topic, now I want to extract the json key and value so that
> I can insert it into jdbc database.
> 
> sample json payload : { "id": 1, "name": "Test" }
> 
> My Camel route looks like this :
> 
> from("mqtt:bar?subscribeTopicName=test=tcp://localhost:1883")
> .process(new MyProcessor()) // Extract json data here
> .to("jdbc:myDataSource?resetAutoCommit=false");
> 
> Can any one help me on how to get the values.
> 
> Thanks
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-
> Extract-json-key-value-from-MQTT-payload-tp5801958.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel performance issue

2017-03-06 Thread Steve Huston
Did you run it multiple times in succession for each scenario? The file system 
cache may skew your timing if you just run it once.

> -Original Message-
> From: RichardChen [mailto:richard.c...@spsoft-cn.com]
> Sent: Monday, March 06, 2017 5:13 AM
> To: users@camel.apache.org
> Subject: Camel performance issue
> 
> We are facing performance problem when we integrate camel into our
> product.
> The simple scenario is this: let camel monitor a folder, put 1000 xml files to
> that folder, camel consume all the files and send them to ActiveMQ.
> 
> I ran this scenario in both physical machine and VM(hosted on the same
> physical machine). The result is really confused me, the VM's performance is
> higher than physical machine.
> I found that, camel on VM consumed files very fast, but meanwhie physical
> machine was slow.
> 
> Anthoer thing is our product pervious using Mule ESB, the performance is
> higher than camel when running the same scenario.
> 
> Our testing evniroment is clean, no anti-virus software installed. Do OS
> version impact the result?
> We are using Windows7 x64 and Windows Server 2012 x64, camel is running
> on Apache Tomcat 8.5.6.
> 
> Have you met the same problem when using camel? Or is there some
> advices on improving performance of my scenario?
> 
> Thanks
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-
> performance-issue-tp5794918.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Passing parameters from routes to components

2017-02-24 Thread Steve Huston
Re properties...

Sure, there is a long description at http://camel.apache.org/properties.html

There are a number of mechanisms for getting the properties injected, depending 
on how you package and deploy your application.  Here is one discussion:
http://stackoverflow.com/questions/19457818/how-do-i-load-a-camel-property-into-a-bean

Also, I have some code that loads properties that are used in a route I define 
in Java DSL. Like this:

public class Routes extends RouteBuilder {
// URI to send requests to.
@PropertyInject("backendUri")
private String backendUri;

private void validateNeededProperties() throws Exception {
if (backendUri == null)
throw new BadConfigurationException("backendUri is not set");
}

@Override
public void configure() throws Exception {
validateNeededProperties();
...
   from(INVOKE_BACKEND_URI).routeId(INVOKE_BACKEND_ROUTE_ID)
.to(backendUri)

-Steve

> -Original Message-
> From: Erol [mailto:e...@erol.si]
> Sent: Friday, February 24, 2017 9:01 AM
> To: users@camel.apache.org
> Subject: RE: Passing parameters from routes to components
> 
> Yes, can you please tell me more or do you maybe have an example?
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Passing-
> parameters-from-routes-to-components-tp5794341p5794429.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Passing parameters from routes to components

2017-02-23 Thread Steve Huston
You could inject property values from outside the routes.

> -Original Message-
> From: Erol [mailto:e...@erol.si]
> Sent: Thursday, February 23, 2017 6:01 AM
> To: users@camel.apache.org
> Subject: Passing parameters from routes to components
> 
> Hello all
> 
> I'm dynamically building routes. Route consists of multiple components. Data
> for each component is saved in the database.
> 
> Currently I have routes like this
> 
> 
> cecf4dec-530d-4d4c-aa31-6f88f6c558d1
> 
> 
> 
> d507ba3e-aa5a-4047-b662-c8ab3abd1f2b
> 
>   headerName="databaseId">
> 6c8511cc-22fd-46e1-8333-70e4b8e2cda1
> 
> 
> 
> 
> Then in each component I access databaseid with @Header("databaseId")
> and use this id to fetch data from database.
> 
> This works, but I feel like I'm overusing headers. Is there a better way?
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Passing-
> parameters-from-routes-to-components-tp5794341.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Not seeing query params on REST DSL

2017-02-10 Thread Steve Huston
I apologize for the delay responding to this.

I was able to get this working but parsing out the URI info separately, like 
the below. It's from a test program so it has some assumptions about what it 
should be getting.

-Steve

---

String httpRequest = 
resultEndpoint.getExchanges().get(0).getIn().getHeader("CamelRestletRequest", 
String.class);
// httpRequest should say PUT http://  HTTP/1.1 - split it to get 
the URL
String[] pieces = httpRequest.split("\\s+");
URL url = new URL(pieces[1]);
String req[] = url.getQuery().split("=");
assertEquals("id query param is present", "id", req[0]);
assertEquals("id query value mismatch", "5678", req[1]);

> -Original Message-
> From: vikson [mailto:vikram.sonawa...@cognizant.com]
> Sent: Thursday, February 09, 2017 1:46 AM
> To: users@camel.apache.org
> Subject: Re: Not seeing query params on REST DSL
> 
> Hi Steve,
> 
> Were you able to find a solution for your query. I'm facing the exact same
> issue; not able to read query params from the URL in case of the RESTLET
> component. I was earlier using the SERVLET component and I was able to
> read the query params as well as the header values from the incoming
> request. I would like to achieve the same using the RESTLET component.
> 
> Code fragment for reference:
> 
> //Rest services exposed
>   rest("/").description("XYZ
> service").consumes(MediaType.APPLICATION_JSON_VALUE).produces(Med
> iaType.APPLICATION_JSON_VALUE)
>   .get("/process?arg1={arg1}={arg2}")
>   .consumes(MediaType.APPLICATION_JSON_VALUE)
> 
> .to("bean:testServiceImpl?method=callTestService(${header.arg1},${header
> .arg2},${header.hdrId})").produces(MediaType.APPLICATION_JSON_VALUE)
> ;
> // hdrId is the header I'm trying to read & this was working with the SERVLET
> component, all request params, header values are read.
> 
> Any help would be appreciated. Thanks.
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Not-
> seeing-query-params-on-REST-DSL-tp5781442p5793707.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: PathParam sample

2016-12-15 Thread Steve Huston
There are lots of examples on the web.
Could you show what you have tried?

-Steve

> On Dec 15, 2016, at 3:47 AM, navajyothi  wrote:
> 
> HiWe are using apache cxf as restful service. We have to pass parameter like
> ID to the User Service.It would be as
> follows:http://localhost:8080/Userservice/101The value is coming as null in
> cxf restful code instead of 101.Is there any sample you can
> share?ThanksNavajyothi
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/PathParam-sample-tp5791478.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: What to do with Null Body messages?

2016-12-06 Thread Steve Huston
You can set the ROUTE_STOP property to true.
http://camel.apache.org/intercept.html has more info.
> -Original Message-
> From: sa_james [mailto:sa_remin...@hotmail.com]
> Sent: Tuesday, December 06, 2016 10:01 AM
> To: users@camel.apache.org
> Subject: What to do with Null Body messages?
> 
> I have a processing Pipeline where I sometimes receive  null-Body Messages.
> When I Forward the Messages to the next steps, there is an error. How do I
> get rid of the null-Body exchanges? I mean, they have to go somewhere.
> Thx.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/What-to-
> do-with-Null-Body-messages-tp5791139.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: receiving with template and sending to the next processing stage

2016-12-06 Thread Steve Huston
You could create a separate Exchange for each message taken from the queue and 
use a producer template to send them. 
http://camel.apache.org/producertemplate.html

-Steve

> -Original Message-
> From: sa_james [mailto:sa_remin...@hotmail.com]
> Sent: Tuesday, December 06, 2016 9:55 AM
> To: users@camel.apache.org
> Subject: receiving with template and sending to the next processing stage
> 
> I am polling a Queue from time to time with a timer and consuming it with a
> template. I want to empty the Queue when it is time so I use a Loop. How do
> I send every single message from my receiveBody to the next processor as I
> am Looping to empty the Queue?
> Thx.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/receiving-
> with-template-and-sending-to-the-next-processing-stage-tp5791137.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Route to two paths

2016-11-30 Thread Steve Huston
You could have a bean or processor check the data and set the next route in a 
header. Then use .toD after the bean/processor to send to the proper next step. 

Steve Huston
(sent from my iPhone - please excuse brevity and typos)

> On Nov 30, 2016, at 9:27 AM, spurcell <scott_purc...@mastercard.com> wrote:
> 
> In a project I am working on, I am parsing a large excel file, and during the
> routing, I am performing some validation on the data. I have a route that
> performs the validation, and if validation is good, I want to continue down
> the same routes that exist. But if the data is invalid, I want to pass it to
> a different route to process and handle database writes there.
> 
> I have went through all the EIP patterns, but do not see one that performs
> what I call a sift, where the good ones go down one path and the bad ones go
> down a different path.
> 
> Can someone assist with possible work arounds for this?
> 
> Thanks
> Scott
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Route-to-two-paths-tp5790803.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Seeking to understand properties

2016-11-16 Thread Steve Huston
Yow - that works!

Thanks, Claus! I understand the IoC aspect of it now.

I still don't understand why getProperty("name") can't work when 
resolvePropertyPlaceholders("{{name}}") will.
In my mind they should be going to the same set of name/value to look up 'name' 
but they're not. Why is that?

Thank you very much,
-Steve

> -Original Message-
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Wednesday, November 16, 2016 4:25 PM
> To: users@camel.apache.org
> Subject: Re: Seeking to understand properties
> 
> That is because @PropertyInject is IoC injected by Camel or Spring when you
> use it to setup the beans. But in your unit test you create that class 
> yourself
> with the new constructor, then its not dependency injection for such things.
> 
> Instead use Camel to create it with
> 
> return context().getInjector().newInstance(MyRouteBuilder.class);
> 
> 
> 
> On Wed, Nov 16, 2016 at 6:51 PM, Steve Huston <shus...@riverace.com>
> wrote:
> > Thank you for the responses thus far. I still have some confusion and an
> observation.
> >
> > First, I find it very confusing and non-intuitive that the "properties" in
> CamelContext are apparently not the "properties" in property placeholder.
> From my reading of the various doc pages it seemed like property
> placeholders are ways to get values from the properties substituted into
> routes. But it seems like maybe there are more than one set, or type, of
> properties. Is this true?
> >
> > My observation... in my test below I added @PropertyInject("datafile") on
> the line above "private String filename;" and that _did_ get the value set via
> useOverridePropertiesWithPropertiesComponent(). However, if I add the
> same @PropertyInject to a member in the MyRouteBuilder class, that _does
> not_ get the value.
> >
> > Can someone please help me understand what's going on here?
> >
> > Thanks,
> > -Steve
> >
> >> -Original Message-
> >> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> >> Sent: Wednesday, November 16, 2016 9:59 AM
> >> To: users@camel.apache.org
> >> Subject: Re: Seeking to understand properties
> >>
> >> Hi
> >>
> >> context().getProperty("dataFile");
> >>
> >> is not property placeholders. Its just generic key/value pairs on
> >> CamelContext. See the javadoc of the API.
> >>
> >> For property placeholders take a look at
> >> http://camel.apache.org/using- propertyplaceholder.html
> >>
> >> On Tue, Nov 15, 2016 at 11:58 PM, Steve Huston <shus...@riverace.com>
> >> wrote:
> >> > I am struggling to understand something I fear is very basic, but I
> >> > just don't
> >> see it. Hoping someone can help me understand this.
> >> >
> >> > Properties... I can use them in route definitions, but I don't seem
> >> > to be able
> >> to obtain their values in regular Java code.
> >> >
> >> > Example (using Camel 2.16.3):
> >> >
> >> > I have a route builder:
> >> >
> >> > public class MyRouteBuilder extends RouteBuilder {
> >> > public void configure() {
> >> > from("file:{{dataFile}}?noop=true")
> >> >  .to("file:target/messages/others");
> >> > }
> >> > }
> >> >
> >> > And a unit test:
> >> >
> >> > @RunWith(JUnit4.class)
> >> > public class UnitTest extends CamelTestSupport {
> >> >
> >> > private String fileName;
> >> >
> >> > @Override
> >> > protected RouteBuilder createRouteBuilder() {
> >> > return new MyRouteBuilder();
> >> > }
> >> >
> >> > @Override
> >> > public Boolean ignoreMissingLocationWithPropertiesComponent()
> {
> >> > return true;
> >> > }
> >> >
> >> > @Override
> >> > protected Properties
> >> useOverridePropertiesWithPropertiesComponent() {
> >> > Properties override = new Properties();
> >> > override.put("dataFile", "overridden-file");
> >> > return override;
> >> > }
> >> >
> >> > @Test
> >> > public void testPropertyGetting() throws Exception {
> >> > fileName = context().getProperty("dataFile");
> >> > assert(fileName != null);
> >> > }
> >> > }
> >> >
> >> > When I run this test, the output includes:
> >> >
> >> > INFO  Route: route1 started and consuming from:
> >> > Endpoint[file://overridden-file?noop=true]
> >> >
> >> > So the override property set above did get filled into the route
> definition.
> >> > However, when I try to get the property in the
> >> > testPropertyGetting() method, the value is null
> >> >
> >> > Why???
> >> >
> >> > -Steve
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -
> >> http://davsclaus.com @davsclaus
> >> Camel in Action 2: https://www.manning.com/ibsen2
> 
> 
> 
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


RE: Seeking to understand properties

2016-11-16 Thread Steve Huston
I'm only setting the property value with the Properties supplied by 
useOverridePropertiesWithPropertiesComponent().

> -Original Message-
> From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> Sent: Wednesday, November 16, 2016 2:45 PM
> To: users@camel.apache.org
> Subject: Re: Seeking to understand properties
> 
> How do you mean it does not get the value? How do you set the property? In
> blueprint? In spring xml or using the plain java via properties file?
> 
> 
> 
> On Wed, Nov 16, 2016 at 6:51 PM, shuston [via Camel] <
> ml-node+s465427n5790193...@n5.nabble.com> wrote:
> 
> > Thank you for the responses thus far. I still have some confusion and
> > an observation.
> >
> > First, I find it very confusing and non-intuitive that the
> > "properties" in CamelContext are apparently not the "properties" in
> property placeholder.
> > From my reading of the various doc pages it seemed like property
> > placeholders are ways to get values from the properties substituted
> > into routes. But it seems like maybe there are more than one set, or
> > type, of properties. Is this true?
> >
> > My observation... in my test below I added @PropertyInject("datafile")
> > on the line above "private String filename;" and that _did_ get the
> > value set via useOverridePropertiesWithPropertiesComponent().
> However,
> > if I add the same @PropertyInject to a member in the MyRouteBuilder
> > class, that _does not_ get the value.
> >
> > Can someone please help me understand what's going on here?
> >
> > Thanks,
> > -Steve
> >
> > > -Original Message-
> > > From: Claus Ibsen [mailto:[hidden email]
> > <http:///user/SendEmail.jtp?type=node=5790193=0>]
> > > Sent: Wednesday, November 16, 2016 9:59 AM
> > > To: [hidden email]
> > <http:///user/SendEmail.jtp?type=node=5790193=1>
> > > Subject: Re: Seeking to understand properties
> > >
> > > Hi
> > >
> > > context().getProperty("dataFile");
> > >
> > > is not property placeholders. Its just generic key/value pairs on
> > > CamelContext. See the javadoc of the API.
> > >
> > > For property placeholders take a look at
> > > http://camel.apache.org/using- propertyplaceholder.html
> > >
> > > On Tue, Nov 15, 2016 at 11:58 PM, Steve Huston <[hidden email]
> > <http:///user/SendEmail.jtp?type=node=5790193=2>>
> > > wrote:
> > > > I am struggling to understand something I fear is very basic, but
> > > > I
> > just don't
> > > see it. Hoping someone can help me understand this.
> > > >
> > > > Properties... I can use them in route definitions, but I don't
> > > > seem to
> > be able
> > > to obtain their values in regular Java code.
> > > >
> > > > Example (using Camel 2.16.3):
> > > >
> > > > I have a route builder:
> > > >
> > > > public class MyRouteBuilder extends RouteBuilder {
> > > > public void configure() {
> > > > from("file:{{dataFile}}?noop=true")
> > > >  .to("file:target/messages/others");
> > > > }
> > > > }
> > > >
> > > > And a unit test:
> > > >
> > > > @RunWith(JUnit4.class)
> > > > public class UnitTest extends CamelTestSupport {
> > > >
> > > > private String fileName;
> > > >
> > > > @Override
> > > > protected RouteBuilder createRouteBuilder() {
> > > > return new MyRouteBuilder();
> > > > }
> > > >
> > > > @Override
> > > > public Boolean
> > > > ignoreMissingLocationWithPropertiesComponent()
> > {
> > > > return true;
> > > > }
> > > >
> > > > @Override
> > > > protected Properties
> > > useOverridePropertiesWithPropertiesComponent() {
> > > > Properties override = new Properties();
> > > > override.put("dataFile", "overridden-file");
> > > > return override;
> > > > }
> > > >
> > > > @Test
> > > > public void testPropertyGetting() throws Exception {
&

RE: Seeking to understand properties

2016-11-16 Thread Steve Huston
Thank you for the responses thus far. I still have some confusion and an 
observation.

First, I find it very confusing and non-intuitive that the "properties" in 
CamelContext are apparently not the "properties" in property placeholder. From 
my reading of the various doc pages it seemed like property placeholders are 
ways to get values from the properties substituted into routes. But it seems 
like maybe there are more than one set, or type, of properties. Is this true?

My observation... in my test below I added @PropertyInject("datafile") on the 
line above "private String filename;" and that _did_ get the value set via 
useOverridePropertiesWithPropertiesComponent(). However, if I add the same 
@PropertyInject to a member in the MyRouteBuilder class, that _does not_ get 
the value.

Can someone please help me understand what's going on here? 

Thanks,
-Steve

> -Original Message-
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Wednesday, November 16, 2016 9:59 AM
> To: users@camel.apache.org
> Subject: Re: Seeking to understand properties
> 
> Hi
> 
> context().getProperty("dataFile");
> 
> is not property placeholders. Its just generic key/value pairs on
> CamelContext. See the javadoc of the API.
> 
> For property placeholders take a look at http://camel.apache.org/using-
> propertyplaceholder.html
> 
> On Tue, Nov 15, 2016 at 11:58 PM, Steve Huston <shus...@riverace.com>
> wrote:
> > I am struggling to understand something I fear is very basic, but I just 
> > don't
> see it. Hoping someone can help me understand this.
> >
> > Properties... I can use them in route definitions, but I don't seem to be 
> > able
> to obtain their values in regular Java code.
> >
> > Example (using Camel 2.16.3):
> >
> > I have a route builder:
> >
> > public class MyRouteBuilder extends RouteBuilder {
> > public void configure() {
> > from("file:{{dataFile}}?noop=true")
> >  .to("file:target/messages/others");
> > }
> > }
> >
> > And a unit test:
> >
> > @RunWith(JUnit4.class)
> > public class UnitTest extends CamelTestSupport {
> >
> > private String fileName;
> >
> > @Override
> > protected RouteBuilder createRouteBuilder() {
> > return new MyRouteBuilder();
> > }
> >
> > @Override
> > public Boolean ignoreMissingLocationWithPropertiesComponent() {
> > return true;
> > }
> >
> > @Override
> > protected Properties
> useOverridePropertiesWithPropertiesComponent() {
> > Properties override = new Properties();
> > override.put("dataFile", "overridden-file");
> > return override;
> > }
> >
> > @Test
> > public void testPropertyGetting() throws Exception {
> > fileName = context().getProperty("dataFile");
> > assert(fileName != null);
> > }
> > }
> >
> > When I run this test, the output includes:
> >
> > INFO  Route: route1 started and consuming from:
> > Endpoint[file://overridden-file?noop=true]
> >
> > So the override property set above did get filled into the route definition.
> > However, when I try to get the property in the testPropertyGetting()
> > method, the value is null
> >
> > Why???
> >
> > -Steve
> >
> 
> 
> 
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


RE: Seeking to understand properties

2016-11-16 Thread Steve Huston
I tried @PropertyInject also, but I also have some confusion on where to set 
the property values. If I set these routes up in spring boot I can get a 
properties file pretty reliably, but with plain camel test support, not sure 
how to make this happen.

> -Original Message-
> From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> Sent: Wednesday, November 16, 2016 3:08 AM
> To: users@camel.apache.org
> Subject: Re: Seeking to understand properties
> 
> I am not sure you can get the property that away. From my understanding
> using useOverridePropertiesWithPropertiesComponent is usually for when
> you have properties set in a blueprint or spring bean and you want to
> override them in your tests. You may want to inject test properties rather
> than the normal ones. I usually use @PropertyInject annotation, I am not
> sure those properties are available at the context level. Perhaps some of the
> Camel developers can explain better.
> 
> On Tue, Nov 15, 2016 at 11:59 PM, shuston [via Camel] <
> ml-node+s465427n5790156...@n5.nabble.com> wrote:
> 
> > I am struggling to understand something I fear is very basic, but I
> > just don't see it. Hoping someone can help me understand this.
> >
> > Properties... I can use them in route definitions, but I don't seem to
> > be able to obtain their values in regular Java code.
> >
> > Example (using Camel 2.16.3):
> >
> > I have a route builder:
> >
> > public class MyRouteBuilder extends RouteBuilder {
> > public void configure() {
> > from("file:{{dataFile}}?noop=true")
> >  .to("file:target/messages/others");
> > }
> > }
> >
> > And a unit test:
> >
> > @RunWith(JUnit4.class)
> > public class UnitTest extends CamelTestSupport {
> >
> > private String fileName;
> >
> > @Override
> > protected RouteBuilder createRouteBuilder() {
> > return new MyRouteBuilder();
> > }
> >
> > @Override
> > public Boolean
> > ignoreMissingLocationWithPropertiesComponent()
> > {
> > return true;
> > }
> >
> > @Override
> > protected Properties
> > useOverridePropertiesWithPropertiesComponent()
> > {
> > Properties override = new Properties();
> > override.put("dataFile", "overridden-file");
> > return override;
> > }
> >
> > @Test
> > public void testPropertyGetting() throws Exception {
> > fileName = context().getProperty("dataFile");
> > assert(fileName != null);
> > }
> > }
> >
> > When I run this test, the output includes:
> >
> > INFO  Route: route1 started and consuming from:
> > Endpoint[file://overridden-file?noop=true]
> >
> >
> > So the override property set above did get filled into the route
> > definition.
> > However, when I try to get the property in the testPropertyGetting()
> > method, the value is null
> >
> > Why???
> >
> > -Steve
> >
> >
> >
> > --
> > If you reply to this email, your message will be added to the
> > discussion
> > below:
> > http://camel.465427.n5.nabble.com/Seeking-to-understand-
> > properties-tp5790156.html
> > To start a new topic under Camel - Users, email
> > ml-node+s465427n465428...@n5.nabble.com
> > To unsubscribe from Camel - Users, click here
> >
>  u
> >
> bscribe_by_code=465428=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> BnbWFpb
> > C5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > .
> > NAML
> >
>  r
> >
> o_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.na
> mesp
> > aces.BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.vi
> >
> ew.web.template.NodeNamespace=notify_subscribers%21n
> abble%
> > 3Aemail.naml-instant_emails%21nabble%3Aemail.naml-
> send_instant_email%2
> > 1nabble%3Aemail.naml>
> >
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Seeking-
> to-understand-properties-tp5790156p5790162.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Seeking to understand properties

2016-11-15 Thread Steve Huston
I am struggling to understand something I fear is very basic, but I just don't 
see it. Hoping someone can help me understand this.

Properties... I can use them in route definitions, but I don't seem to be able 
to obtain their values in regular Java code.

Example (using Camel 2.16.3):

I have a route builder:

public class MyRouteBuilder extends RouteBuilder {
public void configure() {
from("file:{{dataFile}}?noop=true")
 .to("file:target/messages/others");
}
}

And a unit test:

@RunWith(JUnit4.class)
public class UnitTest extends CamelTestSupport {

private String fileName;

@Override
protected RouteBuilder createRouteBuilder() {
return new MyRouteBuilder();
}

@Override
public Boolean ignoreMissingLocationWithPropertiesComponent() {
return true;
}

@Override
protected Properties useOverridePropertiesWithPropertiesComponent() 
{
Properties override = new Properties();
override.put("dataFile", "overridden-file");
return override;
}

@Test
public void testPropertyGetting() throws Exception {
fileName = context().getProperty("dataFile");
assert(fileName != null);
}
}

When I run this test, the output includes:

INFO  Route: route1 started and consuming from: 
Endpoint[file://overridden-file?noop=true]

So the override property set above did get filled into the route definition.
However, when I try to get the property in the testPropertyGetting() method, 
the value is null

Why???

-Steve



RE: Trouble accessing Response body content from RESTful call

2016-10-25 Thread Steve Huston
I'm having trouble accessing the Response... in the debugger I stopped it and 
show the Response entity member as:

entity  HttpURLConnection$HttpInputStream  (id=73)  

If I try to touch it it throws an exception that the stream is closed.

On return from the web service call, I have these message properties:
BodyType:org.apache.cxf.jaxrs.impl.ResponseImpl, 
Body:{"employeeID":"jdoe27","reason":"The specified employee does not exist."}

-Steve

> -Original Message-
> From: Aravind Rajasekharan Pillai [mailto:aravindrajasekha...@gmail.com]
> Sent: Tuesday, October 25, 2016 5:28 PM
> To: users@camel.apache.org
> Subject: Re: Trouble accessing Response body content from RESTful call
> 
> Hi
> 
>  I don't think you can do a direct conversion to string I think u need to 
> read it
> as a buffered input stream and convert to string. Can you try it that way
> 
> Regards
> Aravind
> 
> > On Oct 25, 2016, at 4:41 PM, Steve Huston <shus...@riverace.com> wrote:
> >
> > Thank you for replying, Aravind!
> >
> > Also interesting - I had a LoggingFeature added to the
> JAXRSClientFactoryBean with which I set up the web service. I removed that
> (and removed the stream cache enabling to get back to starting point). With
> that, I can get a Response into my handler after invoking the service, but
> trying to read the response entity as:
> >
> > String body = wsResponse.readEntity(String.class);
> >
> > I get an exception:
> > javax.ws.rs.client.ResponseProcessingException: Problem with reading the
> data, class java.lang.String, ContentType: application/json;charset=UTF-8.
> >at
> org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(Res
> ponseImpl.java:439)
> >at
> org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:37
> 9)
> >at
> org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:320)
> >at
> > org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:31
> > 0)
> > ... in my code
> > Caused by: java.io.IOException: stream is closed
> >at
> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.ensureOp
> en(HttpURLConnection.java:3308)
> >at
> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Http
> URLConnection.java:)
> >at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
> >at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
> >at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
> >at java.io.InputStreamReader.read(InputStreamReader.java:184)
> >at java.io.Reader.read(Reader.java:140)
> >at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:316)
> >at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:304)
> >at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:288)
> >at
> org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvid
> er.java:45)
> >at
> org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvid
> er.java:36)
> >at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSU
> tils.java:1366)
> >at
> org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:37
> 0)
> >... 23 more
> >
> >> -Original Message-
> >> From: aravind r [mailto:aravindrajasekha...@gmail.com]
> >> Sent: Tuesday, October 25, 2016 1:39 PM
> >> To: users@camel.apache.org
> >> Subject: Re: Trouble accessing Response body content from RESTful
> >> call
> >>
> >> Hi Steve,
> >>
> >> Are u logging the Message body somewhere before consuming (say
> Camel
> >> logger in between),that could also lead to input stream consumption.
> >>
> >> Regards,
> >> Aravind
> >>
> >> On Tue, Oct 25, 2016 at 1:15 PM, Doug Douglass
> >> <douglass.d...@gmail.com>
> >> wrote:
> >>
> >>> I can't say where the response body is being consumed, but try
> >>> enabling stream caching[1] and see what you get.
> >>>
> >>> Doug
> >>>
> >>> [1] http://camel.apache.org/stream-caching.html
> >>>
> >>> On Tue, Oct 25, 2016 at 9:31 AM, Steve Huston <shus...@riverace.com>
> >>> wrote:
> >>>
> >>>> I am developing a route that calls a web service; said web service
> >>> returns
> >>>> a JSON string (Not always the same type represented). I have this
> >>>> in a route as:
> >>>

RE: Trouble accessing Response body content from RESTful call

2016-10-25 Thread Steve Huston
Thank you for replying, Aravind!

Also interesting - I had a LoggingFeature added to the JAXRSClientFactoryBean 
with which I set up the web service. I removed that (and removed the stream 
cache enabling to get back to starting point). With that, I can get a Response 
into my handler after invoking the service, but trying to read the response 
entity as:

String body = wsResponse.readEntity(String.class);

I get an exception:
javax.ws.rs.client.ResponseProcessingException: Problem with reading the data, 
class java.lang.String, ContentType: application/json;charset=UTF-8.
at 
org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(ResponseImpl.java:439)
at 
org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:379)
at 
org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:320)
at 
org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:310)
... in my code
Caused by: java.io.IOException: stream is closed
at 
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.ensureOpen(HttpURLConnection.java:3308)
at 
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:140)
at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:316)
at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:304)
at org.apache.cxf.helpers.IOUtils.toString(IOUtils.java:288)
at 
org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvider.java:45)
at 
org.apache.cxf.jaxrs.provider.StringTextProvider.readFrom(StringTextProvider.java:36)
at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1366)
at 
org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:370)
... 23 more

> -Original Message-
> From: aravind r [mailto:aravindrajasekha...@gmail.com]
> Sent: Tuesday, October 25, 2016 1:39 PM
> To: users@camel.apache.org
> Subject: Re: Trouble accessing Response body content from RESTful call
> 
> Hi Steve,
> 
> Are u logging the Message body somewhere before consuming (say Camel
> logger in between),that could also lead to input stream consumption.
> 
> Regards,
> Aravind
> 
> On Tue, Oct 25, 2016 at 1:15 PM, Doug Douglass <douglass.d...@gmail.com>
> wrote:
> 
> > I can't say where the response body is being consumed, but try
> > enabling stream caching[1] and see what you get.
> >
> > Doug
> >
> > [1] http://camel.apache.org/stream-caching.html
> >
> > On Tue, Oct 25, 2016 at 9:31 AM, Steve Huston <shus...@riverace.com>
> > wrote:
> >
> > > I am developing a route that calls a web service; said web service
> > returns
> > > a JSON string (Not always the same type represented). I have this in
> > > a route as:
> > >
> > >from(myqueue)
> > > .bean(SetupCxfRequest.class)   // This sets up parameters for
> > > REST API call
> > > .convertBodyTo(org.apache.cxf.message.MessageContentsList.class)
> > > .to("cxfrs:bean:ws?throwExceptionOnFailure=false")
> > > .bean(WebServiceResponse.class)
> > >
> > > SetupCxfRequest will:
> > >   exchange.setPattern(ExchangePattern.InOut);
> > >   // Indicate using Proxy API.
> > >   in.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
> > > Boolean.FALSE);
> > >   in.setHeader(CxfConstants.OPERATION_NAME,
> > > VerifyEmployeeRequest);
> > >
> > > The web service interface method for the call in question is:
> > > @GET
> > > @Path(value="/authentication/{company}/employees/{id}")
> > > @Produces({ MediaType.APPLICATION_JSON })
> > > public Response VerifyEmployeeRequest(@PathParam("company")
> > > String scac,
> > >   @PathParam("id") String id,
> > >   @QueryParam("pin") String pin,
> > >   @QueryParam("reason")
> > > String reason);
> > >
> > > The case I'm working now is that the web service is called and it
> > > returns a 404 status with a body of JSON-marshaled stuff I need to get at.
> > > From my route above, WebServiceResponse is then called as:

RE: Trouble accessing Response body content from RESTful call

2016-10-25 Thread Steve Huston
Interesting... I turned on stream caching (thank you, Doug!) and there are two 
differences:

- I can find the text from the response body that I was expecting, but only if 
I remove the first parameter to the handler method and just accept Exchange. If 
I leave it as was,...

- I get an exception thrown because the message body can't be converted from 
org.apache.camel.converter.stream.InputStreamCache to javax.ws.rs.core.Response

> -Original Message-
> From: Doug Douglass [mailto:douglass.d...@gmail.com]
> Sent: Tuesday, October 25, 2016 1:15 PM
> To: users@camel.apache.org
> Subject: Re: Trouble accessing Response body content from RESTful call
> 
> I can't say where the response body is being consumed, but try enabling
> stream caching[1] and see what you get.
> 
> Doug
> 
> [1] http://camel.apache.org/stream-caching.html
> 
> On Tue, Oct 25, 2016 at 9:31 AM, Steve Huston <shus...@riverace.com>
> wrote:
> 
> > I am developing a route that calls a web service; said web service
> > returns a JSON string (Not always the same type represented). I have
> > this in a route as:
> >
> >from(myqueue)
> > .bean(SetupCxfRequest.class)   // This sets up parameters for
> > REST API call
> > .convertBodyTo(org.apache.cxf.message.MessageContentsList.class)
> > .to("cxfrs:bean:ws?throwExceptionOnFailure=false")
> > .bean(WebServiceResponse.class)
> >
> > SetupCxfRequest will:
> >   exchange.setPattern(ExchangePattern.InOut);
> >   // Indicate using Proxy API.
> >   in.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
> > Boolean.FALSE);
> >   in.setHeader(CxfConstants.OPERATION_NAME,
> > VerifyEmployeeRequest);
> >
> > The web service interface method for the call in question is:
> > @GET
> > @Path(value="/authentication/{company}/employees/{id}")
> > @Produces({ MediaType.APPLICATION_JSON })
> > public Response VerifyEmployeeRequest(@PathParam("company")
> String
> > scac,
> >   @PathParam("id") String id,
> >   @QueryParam("pin") String pin,
> >   @QueryParam("reason") String
> > reason);
> >
> > The case I'm working now is that the web service is called and it
> > returns a 404 status with a body of JSON-marshaled stuff I need to get at.
> > From my route above, WebServiceResponse is then called as:
> >
> > public class WebServiceResponse {
> >
> > @Handler
> > public Object convertWebServiceResponse(Response wsResponse,
> > Exchange exchange) throws IOException { ObjectMapper unmarshaller =
> > new ObjectMapper();
> > Class target = null;
> > Message in = exchange.getIn();
> > int opStatus = wsResponse.getStatus();
> > if (opStatus == 200)
> > target = EmployeeVerificationResponseAccept.class;
> > else
> > target =
> > EmployeeVerificationResponseDeny.class;
> >
> > So far, so good - opStatus is 404. I need to get the string which is
> > the response body and then unmarshall it.
> > wsResponse.entity is a SequenceInputStream and one of the input
> > streams appears to be the string I'm expecting from the web service;
> > however, it has been completely consumed (length and position are the
> > same). Where did it go, and how can I get it?
> >
> > Thanks,
> > -Steve
> >
> >


Trouble accessing Response body content from RESTful call

2016-10-25 Thread Steve Huston
I am developing a route that calls a web service; said web service returns a 
JSON string (Not always the same type represented). I have this in a route as:

   from(myqueue)
.bean(SetupCxfRequest.class)   // This sets up parameters for REST 
API call
.convertBodyTo(org.apache.cxf.message.MessageContentsList.class)
.to("cxfrs:bean:ws?throwExceptionOnFailure=false")
.bean(WebServiceResponse.class)

SetupCxfRequest will:
  exchange.setPattern(ExchangePattern.InOut);
  // Indicate using Proxy API.
  in.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, Boolean.FALSE);
  in.setHeader(CxfConstants.OPERATION_NAME, VerifyEmployeeRequest);

The web service interface method for the call in question is:
@GET
@Path(value="/authentication/{company}/employees/{id}")
@Produces({ MediaType.APPLICATION_JSON })
public Response VerifyEmployeeRequest(@PathParam("company") String scac,
  @PathParam("id") String id,
  @QueryParam("pin") String pin,
  @QueryParam("reason") String reason);

The case I'm working now is that the web service is called and it returns a 404 
status with a body of JSON-marshaled stuff I need to get at.
>From my route above, WebServiceResponse is then called as:

public class WebServiceResponse {

@Handler
public Object convertWebServiceResponse(Response wsResponse, Exchange 
exchange) throws IOException {  ObjectMapper 
unmarshaller = new ObjectMapper();
Class target = null;
Message in = exchange.getIn();
int opStatus = wsResponse.getStatus();
if (opStatus == 200)
target = EmployeeVerificationResponseAccept.class;
else
target = EmployeeVerificationResponseDeny.class;

So far, so good - opStatus is 404. I need to get the string which is the 
response body and then unmarshall it.
wsResponse.entity is a SequenceInputStream and one of the input streams appears 
to be the string I'm expecting from the web service; however, it has been 
completely consumed (length and position are the same). Where did it go, and 
how can I get it?

Thanks,
-Steve



RE: Camel Log - Karaf

2016-10-20 Thread Steve Huston
I'm only guessing sort of, but try the camel context id.

You could get a more definitive answer by letting it log DEBUG everything, find 
the lines you want from your route(s) and note the name they're logged under, 
then just use that.

-Steve

> -Original Message-
> From: ychawla [mailto:premiergenerat...@gmail.com]
> Sent: Thursday, October 20, 2016 2:09 PM
> To: users@camel.apache.org
> Subject: RE: Camel Log - Karaf
> 
> Hi Shuston,
> I can do log:set DEBUG but then I log everything.  I have a file endpoint 
> that I
> poll from and that generates too much logging for it to be useful.
> Is there a way to isolate it to the route or context level?
> 
> Thanks,
> Yogesh
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-
> Log-Karaf-tp5789034p5789046.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel Log - Karaf

2016-10-20 Thread Steve Huston
Try log:set DEBUG


> -Original Message-
> From: ychawla [mailto:premiergenerat...@gmail.com]
> Sent: Thursday, October 20, 2016 11:34 AM
> To: users@camel.apache.org
> Subject: Camel Log - Karaf
> 
> Hello All,
> I have a log statement in a camel route that is at the DEBUG loggingLevel:
> 
> 
> 
> From the karaf console, how can I set the logging level for the camel context?
> 
> I know that I can run a karaf command like this to set the logging level for a
> java package:
> 
> log:set DEBUG org.packagename.here
> 
> However, I am not sure what to use for the package name for a camel route
> or camel context.  Any ideas on how I can change the logging level for a camel
> route?
> 
> Thanks,
> Yogesh
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-
> Log-Karaf-tp5789034.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread Steve Huston
I would start by chasing this as a firewall/routing problem with your network 
infrastructure people.

> -Original Message-
> From: ganga_camel [mailto:ganga...@gmail.com]
> Sent: Friday, October 14, 2016 9:37 AM
> To: users@camel.apache.org
> Subject: RE: Rest DSL with restlet Component, unable to access API when
> hosted on remote server
> 
> This is the error message that I get
> 
> Could not get any response
> There was an error connecting to
> http://:8081/bnt?9780226519791,9780415762564.
> 
> Why this might have happened:
> The server couldn't send a response:
> Ensure that the backend is working properly SSL connections are being
> blocked:
> Fix this by importing SSL certificates in Chrome Cookies not being sent:
> Use the Postman Interceptor extension
> Request timeout:
> Change request timeout in Settings > General
> 
> Thanks,
> Ganga
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Rest-DSL-
> with-restlet-Component-unable-to-access-API-when-hosted-on-remote-
> server-tp5788789p5788794.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread Steve Huston
Sounds like a firewall (or similar) configuration issue.

If not, please try posting more about what's not working - error messages, etc.

-Steve

> -Original Message-
> From: ganga_camel [mailto:ganga...@gmail.com]
> Sent: Friday, October 14, 2016 9:00 AM
> To: users@camel.apache.org
> Subject: Rest DSL with restlet Component, unable to access API when hosted
> on remote server
> 
> Hi,I have a camel route with Rest DSL using the restlet component,
> configuration as listed
> belowrestConfiguration().component("restlet").host("{{hostname}}").port("
> {{port}}")
> .dataFormatProperty("prettyPrint", "true");
> rest("/books").consumes(MediaType.ALL.toString())
> .produces(MediaType.ALL.toString())
> .post().to("direct:ProcessData");When I run the camel service on my local
> machine with port as anything other than 8080(eg: 9091, 8081 etc), I am
> able successfully post to the Rest API.However, when I deploy the rest API
> code on the remote server to listen on port 9091 or 8081 etc... (anything
> other than port 8080), I am unable to post to the rest API. But am able to
> successfully post to rest API deployed on remote server when the port is set
> to 8080.This behavior is observed only when the rest API is deployed on
> remote host but works fine with any port number when rest API is running
> on the local machine.Any suggestions would be highly
> appreciated.Thanks,Ganga
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Rest-DSL-
> with-restlet-Component-unable-to-access-API-when-hosted-on-remote-
> server-tp5788789.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel route with AMQP consumer runs ok in Eclipse, hangs in karaf

2016-10-10 Thread Steve Huston
Thank you SO much! That fixed it.

> -Original Message-
> From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> Sent: Monday, October 10, 2016 6:22 AM
> To: users@camel.apache.org
> Subject: Re: Camel route with AMQP consumer runs ok in Eclipse, hangs in
> karaf
> 
> Hi Steve
> 
> I think I wrote a comment on stackoverflow for you.
> 
> Best
> Souciance
> 
> On Mon, Oct 10, 2016 at 11:15 AM, Steve Huston [via Camel] <
> ml-node+s465427n5788554...@n5.nabble.com> wrote:
> 
> > I posted this in stackoverflow, hoping for some expertise here. I
> > would really appreciate some hel from the experts.
> >
> > Camel route with AMQP consumer runs ok in Eclipse, hangs in karaf
> > http://stackoverflow.com/q/39939964/240342?sem=2
> >
> > Thanks!
> > -Steve
> >
> >
> > --
> > If you reply to this email, your message will be added to the
> > discussion
> > below:
> > http://camel.465427.n5.nabble.com/Camel-route-with-AMQP-
> > consumer-runs-ok-in-Eclipse-hangs-in-karaf-tp5788554.html
> > To start a new topic under Camel - Users, email
> > ml-node+s465427n465428...@n5.nabble.com
> > To unsubscribe from Camel - Users, click here
> >
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=uns
> u
> >
> bscribe_by_code=465428=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> BnbWFpb
> > C5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > .
> > NAML
> >
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=mac
> r
> >
> o_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.na
> mesp
> > aces.BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.vi
> >
> ew.web.template.NodeNamespace=notify_subscribers%21n
> abble%
> > 3Aemail.naml-instant_emails%21nabble%3Aemail.naml-
> send_instant_email%2
> > 1nabble%3Aemail.naml>
> >
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-
> route-with-AMQP-consumer-runs-ok-in-Eclipse-hangs-in-karaf-
> tp5788554p5788556.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Camel route with AMQP consumer runs ok in Eclipse, hangs in karaf

2016-10-10 Thread Steve Huston
I posted this in stackoverflow, hoping for some expertise here. I would really 
appreciate some hel from the experts.

Camel route with AMQP consumer runs ok in Eclipse, hangs in karaf
http://stackoverflow.com/q/39939964/240342?sem=2

Thanks!
-Steve


RE: Access header in camel route

2016-10-05 Thread Steve Huston
I believe for the "to" routing, it's plain text... if you want to use a header 
value you need to use dynamic to:

http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
http://www.davsclaus.com/2015/10/apache-camel-216-released-top-10.html

-Steve

> -Original Message-
> From: koperdraat...@gmail.com [mailto:koperdraat...@gmail.com] On
> Behalf Of Jonas Koperdraat
> Sent: Wednesday, October 05, 2016 7:25 AM
> To: users@camel.apache.org
> Subject: Re: Access header in camel route
> 
> I believe the right way to access a header is either by using
> ${header.fieldname} or by using the @Header annotation.
> 
> See http://camel.apache.org/simple.html
> and http://camel.apache.org/parameter-binding-annotations.html for
> references.
> 
> Regards,
> 
> Jonas
> 
> On Wed, Oct 5, 2016 at 9:31 AM, axdz  wrote:
> > Hi all,
> >
> > I config a route in xml file
> >
> >  *
> > 
> > 
> > 
> >
> > *
> >
> > and here i MyProcessor class
> >* public class MyProcessor implements Processor {
> >
> > public void process(Exchange exchange) throws Exception {
> > exchange.getIn().setHeader("fieldname", "valuename");
> > }
> >
> > }*
> >
> > Above code can not show "valuename" by ${in.header.fieldname}.
> > Please give me some advice,
> > Thanks,
> >
> >
> >
> > --
> > View this message in context:
> > http://camel.465427.n5.nabble.com/Access-header-in-camel-route-
> tp57883
> > 72.html Sent from the Camel - Users mailing list archive at
> > Nabble.com.


Re: Set camel route based on timer or a count variable

2016-10-01 Thread Steve Huston
You can use quartz2 or timer in camel, but I’m not sure how to incorporate the 
reset on count.

-Steve

> On Sep 30, 2016, at 3:39 PM, Vik  wrote:
> 
> I want to invoke another camel route based on a counter value or after
> certain time has passed whichever happens first. For example, if count has
> reached N before timer is invoked, I want to reset the timer and invoke the
> route. Similarly, if timer is invoked, reset the count and invoke the route.
> I looked at content based routing but, how would I deal with Timer part?
> 
> I can do it in Java using ScheduledThreadPoolExecutor to cancel the task if
> count is reached and then invoke route in java. But, I was wondering if
> there is an easy way to do it with camel. I am new to Camel, so not aware
> about advanced functionality it can provide.
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Set-camel-route-based-on-timer-or-a-count-variable-tp5788270.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



RE: JMS Component configurations

2016-09-13 Thread Steve Huston
Put that info in a bean?

> -Original Message-
> From: dpravin [mailto:pravin.deshm...@gmail.com]
> Sent: Monday, September 12, 2016 9:32 PM
> To: users@camel.apache.org
> Subject: JMS Component configurations
> 
> Hello All,
> 
> We are in process of implementing hundreds of routes that will use Camel.
> Many of the routes will use remote instance of AMQ, local AMQ or WMQ to
> process the messages. Each of the routes will have the same (connection
> pooling) code/configuration repeated to connect to any one of these
> resources. Is there any solution that can reduce this boiler plate
> code/configuration.
> 
> Thanks,
> Pravin
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/JMS-
> Component-configurations-tp5787499.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel send/receive UDP with Netty4

2016-08-31 Thread Steve Huston
I'm not an expert on the camel you show, but try changing:
from(String.format("netty4:udp://localhost:%d?sync=false=true",

to

from(String.format("netty4:udp://0.0.0.0:%d?sync=false=true",

> -Original Message-
> From: Steve973 [mailto:steve...@gmail.com]
> Sent: Wednesday, August 31, 2016 10:29 AM
> To: users@camel.apache.org
> Subject: Camel send/receive UDP with Netty4
> 
> Hello, All.  I am trying to create an example where I can receive UDP packets
> with the Netty4 component, but it isn't working.  I'm sending UDP packets
> with a DatagramSocket to localhost, and I have a camel route consuming
> from netty4:udp//localhost on the port the DatagramSocket sent to.  Here's
> the code:
> 
> public class UdpWithCamelService implements BundleActivator {
> private static final Logger LOGGER =
> LoggerFactory.getLogger(UdpWithCamelService.class);
> public static final int SERVER_PORT = 2;
> public static final int RECEIVER_PORT = 3;
> private OsgiDefaultCamelContext camelContext;
> private RouteBuilder routeBuilder;
> private ScheduledExecutorService scheduler;
> private UdpSender sender;
> 
> public UdpWithCamelService() throws Exception {
> scheduler = Executors.newSingleThreadScheduledExecutor();
> sender = new UdpSender();
> }
> 
> @Override
> public void start(BundleContext context) throws Exception {
> camelContext = new OsgiDefaultCamelContext(context);
> camelContext.start();
> routeBuilder = new CamelUdpReceiverRouteBuilder();
> camelContext.addRoutes(routeBuilder);
> final Runnable senderTask = () -> {
> try {
> sender.sendTimestamp();
> LOGGER.warn("Sent timestamp via UDP");
> } catch (Exception e) {
> LOGGER.error("Problem sending timestamp via UDP", e);
> }
> };
> scheduler.scheduleAtFixedRate(senderTask, 1, 1, TimeUnit.SECONDS);
> }
> 
> @Override
> public void stop(BundleContext context) throws Exception {
> scheduler.shutdown();
> sender.stop();
> 
> camelContext.removeRouteDefinitions(routeBuilder.getRouteCollection().g
> etRoutes());
> camelContext = null;
> }
> }
> 
> public class UdpSender {
> private final DatagramSocket socket;
> 
> public UdpSender() throws Exception {
> socket = new DatagramSocket(UdpWithCamelService.SERVER_PORT);
> }
> 
> public void stop() {
> socket.disconnect();
> socket.close();
> }
> 
> public void sendTimestamp() throws Exception {
> String timestamp = String.valueOf(System.currentTimeMillis());
> socket.send(
> new DatagramPacket(
> timestamp.getBytes(), timestamp.getBytes().length,
> InetAddress.getLocalHost(), UdpWithCamelService.RECEIVER_PORT
> )
> );
> }
> }
> 
> public class CamelUdpReceiverRouteBuilder extends RouteBuilder {
> private static final Logger LOGGER =
> LoggerFactory.getLogger(CamelUdpReceiverRouteBuilder.class);
> 
> @Override
> public void configure() throws Exception {
> 
> from(String.format("netty4:udp://localhost:%d?sync=false=true",
> UdpWithCamelService.RECEIVER_PORT))
> .process(exchange -> {
> String body = exchange.getIn().getBody(String.class);
> LOGGER.warn("UDP Packet Received: " + body);
> });
> }
> }
> 
> Thanks in advance,
> 
> Steve


RE: Unit test case for XML DSL context and routes

2016-07-05 Thread Steve Huston
http://camel.apache.org/testing.html

> -Original Message-
> From: Vanshul.Chawla [mailto:vanshul.cha...@target.com]
> Sent: Tuesday, July 05, 2016 10:08 AM
> To: users@camel.apache.org
> Subject: Unit test case for XML DSL context and routes
> 
> Hello All,
> 
> We have some Camel code which is written in XML DSL. We need to add unit
> test cases for each context(multiple routes) . Could someone please give a
> lead to how this can be achieved.
> 
> Vanshul


RE: Apache Camel + Microsoft Azure Service Bus

2016-06-22 Thread Steve Huston
Azure supports AMQP, you should be able to use the JMS component in Camel.

I think MS has learned that locking people onto one choice is not a good idea, 
particularly with developers.

> -Original Message-
> From: jamie3 [mailto:jam...@gmail.com]
> Sent: Wednesday, June 22, 2016 10:29 AM
> To: users@camel.apache.org
> Subject: Apache Camel + Microsoft Azure Service Bus
> 
> I am wondering if there is a component for Azure Service Bus. IIRC service
> bus supports AMQP but I am wondering if there is a native component?
> 
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-
> Camel-Microsoft-Azure-Service-Bus-tp5784320.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Generic camel routes - multiple instances

2016-06-10 Thread Steve Huston
I am doing something like this, and plan to use a separate source file (like 
below) that instantiates the route builders (that are in other sources) for 
each set of routes that only vary by the properties.

When SCR sets this up at run time it injects the properties values into the 
routes.

> -Original Message-
> From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> Sent: Friday, June 10, 2016 9:46 AM
> To: users@camel.apache.org
> Subject: RE: Generic camel routes - multiple instances
> 
> Does that mean for SCR you define multiple properties like below, one for
> each instance you want and the actual instancesiation is done auto-
> magically? What I mean is, if I want three routes with different parameters,
> do I define the three different Properties and that is it, or is there more 
> to it?
> 
> Component(label = CamelScrExample.COMPONENT_LABEL, description =
> CamelScrExample.COMPONENT_DESCRIPTION, immediate = true, metatype
> = true) @Properties({
> @Property(name = "camelContextId", value = "camel-scr-example"),
> @Property(name = "camelRouteId", value = "foo/timer-log"),
> @Property(name = "active", value = "true"),
> @Property(name = "from", value = "timer:foo?period=5000"),
> @Property(name = "to", value = "log:foo?showHeaders=true"),
> @Property(name = "messageOk", value = "Success: {{from}} -> {{to}}"),
> @Property(name = "messageError", value = "Failure: {{from}} -> {{to}}"),
> @Property(name = "maximumRedeliveries", value = "0"),
> @Property(name = "redeliveryDelay", value = "5000"),
> @Property(name = "backOffMultiplier", value = "2"),
> @Property(name = "maximumRedeliveryDelay", value = "6")
> })
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Generic-
> camel-routes-multiple-instances-tp5783866p5783873.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Generic camel routes - multiple instances

2016-06-10 Thread Steve Huston
I use Camel SCR for this sort of thing. It works, but is probably not the only 
way.

> -Original Message-
> From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> Sent: Friday, June 10, 2016 9:29 AM
> To: users@camel.apache.org
> Subject: Generic camel routes - multiple instances
> 
> Hello,
> 
> Are there any good places to read or examples to see, of how to build
> generic camel routes? For example:
> 
> I have 10 routes which differ only in their endpoints and some headers and
> processors.
> 
> I would like to create a generic route and have the endpoint URI and other
> parameters injected and hence have multiple instances of the route to be
> created with the different endpoints. Is this possible to do? Are there any
> drawbacks to this approach e.g. for testing?
> 
> Best
> Souciance
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Generic-
> camel-routes-multiple-instances-tp5783866.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: How to Mock Kafka Consumer Endpoint with Spock Framework Unit Test cases

2016-06-10 Thread Steve Huston
I am relatively new to camel, but until you get more experienced replies, I'd 
suggest your second path (replaceFromWith) but use something like 
seda:mockKafka - then send your test messages to seda:mockKafka. I'm under the 
impression that a mock can't produce a message, which is why you're getting the 
UnsupportedOperationException.

-Steve

> -Original Message-
> From: ganga_camel [mailto:ganga...@gmail.com]
> Sent: Friday, June 10, 2016 7:59 AM
> To: users@camel.apache.org
> Subject: How to Mock Kafka Consumer Endpoint with Spock Framework Unit
> Test cases
> 
> Hi,
> 
> I am using Spock Framework to perform Unit Testing of Camel Routes. My
> first route consumes from Kafka Consumer Endpoint. I need to mock this end
> point and send the message to mock endpoint as part of the unit testing,
> below is how I have tried
> 
> camelctx.getRouteDefinitions().get(0).adviceWith(camelctx, new
> AdviceWithRouteBuilder() {
> @Override
> void configure() throws Exception {
> 
> interceptSendToEndpoint("kafka:{{server}}?topic={{topic}}
> ={{zookeeper}}={{zookeeperport}}={{group}}
> oCommitEnable=true=smallest=1
> 000")
> .skipSendToOriginalEndpoint()
> .to("mock:kafkaCon")
> }
> })
> 
> Here I get the error "java.lang.NullPointerException: Cannot invoke method
> getIn() on null object" .
> 
> I have also tried
>  camelctx.getRouteDefinitions().get(0).adviceWith(camelctx, new
> AdviceWithRouteBuilder() {
> @Override
> void configure() throws Exception {
>replaceFromWith("mock:kafkaCon")
> }
> })
> I get the error "java.lang.UnsupportedOperationException: You cannot
> consume from this endpoint"
> 
> Any suggession on how to Mock the Kafka Consumer endpoint and advise if I
> am trying to do it wrong..
> 
> -Ganga
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-
> Mock-Kafka-Consumer-Endpoint-with-Spock-Framework-Unit-Test-cases-
> tp5783856.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: IBM MQ to Active MQ migration

2016-06-03 Thread Steve Huston
IBM MQ -> ActiveMQ is a separate activity from using camel, or are you already 
using camel with IBM MQ?

-teve

> -Original Message-
> From: tanay94 [mailto:tanay.jos...@gmail.com]
> Sent: Friday, June 03, 2016 2:15 AM
> To: users@camel.apache.org
> Subject: IBM MQ to Active MQ migration
> 
> I want to migrate applications from IBM MQ to Active MQ. I would prefer
> using camel. Since I am new to this technology, I would appreciate if
> someone helps me to build it from scratch.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/IBM-MQ-
> to-Active-MQ-migration-tp5783408.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Routing with logic

2016-05-23 Thread Steve Huston
I am not a Camel expert, but one way to approach this would be to have a 
process that reads from your external APIs and put the resulting messages into 
a queue (for example, using AMQP). Then your camel route can read messages 
'from' the queue.

If your external APIs have a camel component integration, that would be easier.

-Steve Huston

> -Original Message-
> From: miri eyni [mailto:miri.e...@sapiens.com]
> Sent: Monday, May 23, 2016 6:39 AM
> To: users@camel.apache.org
> Subject: Routing with logic
> 
> hi
>  i need to implement routing with processing.
> processing the request should read from different APIs (external API ) for
> create a new request to the endpoint.
> 
> how is the best way to implements it?
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Routing-
> with-logic-tp5782944.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel jms Request reply -scenario with separate queues for request and response

2016-05-18 Thread Steve Huston
> I have 2 queues provided by third party provider 1.request queue, 2.reply
> queue
> 
> using camel jms i will send request to request queue, so third party provider
> will push respective response to response queue.

Ok.

> I would to make these calls synchronous. so for each request send  to
> request queue ,i need to get response (from response queue) *in same
> thread*(as like http). Would request-reply(inout) pattern in camel helps to
> achieve this?

Yes. I'm not 100% sure of the "same thread" restriction, but your route would 
not get control again until the response arrives.

> Can you please post examples of sample routes to get an idea...

I don't have a ready-made example for that, but the Camel JMS page at 
http://camel.apache.org/jms.html has the options - read the "About using Camel 
to send and receive messages and JMSReplyTo" section for details of adapting it 
to your scenario.

-Steve




RE: Trouble sending a ByteBuffer to a mock

2016-05-11 Thread Steve Huston
Closing the loop on this... the issue ended up being that when the Exchange got 
to the end of the route and went back to the 'from' (which was a cxfrs REST 
point) that piece complained about the ByteBuffer. In my case the solution 
ended up being adding another processor after the "end" to set up a Response 
for REST.

-Steve

> -Original Message-
> From: Steve Huston
> Sent: Thursday, April 28, 2016 7:04 PM
> To: 'users@camel.apache.org' <users@camel.apache.org>
> Subject: Trouble sending a ByteBuffer to a mock
> 
> I am using Camel 2.16.3. I have a route like so:
> 
>from("direct:sendPing").routeId("rms-send-ping")
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception {
>   Message in = exchange.getIn();
> AssetPing p = new AssetPing(in.getHeader("emp", String.class),
> in.getHeader("id", int.class));
> exchange.getIn().setBody(p);
>}
> })
> .convertBodyTo(IsmpAssetPingMessage.class)
> .process(new Processor() {
>   public void process(Exchange exchange) throws Exception {
>   IsmpAssetPingMessage emp =
> exchange.getIn().getBody(IsmpAssetPingMessage.class);
>   emp.setSrcAddress(mrEmpAddress);
>   }
> })
> .convertBodyTo(ByteBuffer.class)
> .removeHeaders("*")
> .to(toRoma).id("sendToRoma");
> 
> In a unit test, I adviceWIth it to replace that last "to", as:
> 
>   context.getRouteDefinition("rms-send-ping").adviceWith(context,
> new AdviceWithRouteBuilder() {
>   @Override
>   public void configure() throws Exception {
>   weaveById("sendToRoma")
>   .replace()
> .to("log:unit")
>   .to("mock:pingCheck");
>   }
> 
> The intention being to extract the message from the mocked end point and
> run some checks on it.
> When the test runs, I see the output from the woven in "log:unit" then I
> have an error:
> 
> 2016-04-28 18:42:33 ERROR JAXRSUtils:1788 - No message body writer has
> been found for class java.nio.HeapByteBuffer, ContentType: text/plain
> 
> Is mock only allowed to have text message bodies written to it?
> 
> My searching for info related to that error has turned up only issues related
> to CXF and REST and problems marshalling to XML/JSON.
> 
> Thanks,
> -Steve Huston


RE: What is direct:start in "camel in action" book?

2016-05-03 Thread Steve Huston
"direct" is a component that's used to inject messages into a route:

http://camel.apache.org/direct.html

"start" and "update", from your examples, are names for "direct" endpoints.

-Steve

> -Original Message-
> From: polanki [mailto:varadaraja.pola...@pimco.com]
> Sent: Tuesday, May 03, 2016 3:02 PM
> To: users@camel.apache.org
> Subject: What is direct:start in "camel in action" book?
> 
> couple of places I saw direct:start and direct:update as below. what does it
> mean
> 
> from("direct:start")
> .transform(body().regexReplaceAll("\n", "")) .to("mock:result");
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/What-is-
> direct-start-in-camel-in-action-book-tp5782137.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Trouble sending a ByteBuffer to a mock

2016-04-28 Thread Steve Huston
I am using Camel 2.16.3. I have a route like so:

   from("direct:sendPing").routeId("rms-send-ping")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
AssetPing p = new AssetPing(in.getHeader("emp", String.class), 
in.getHeader("id", int.class));
exchange.getIn().setBody(p);
   }
})
.convertBodyTo(IsmpAssetPingMessage.class)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
IsmpAssetPingMessage emp = 
exchange.getIn().getBody(IsmpAssetPingMessage.class);
emp.setSrcAddress(mrEmpAddress);
}
})
.convertBodyTo(ByteBuffer.class)
.removeHeaders("*")
.to(toRoma).id("sendToRoma");

In a unit test, I adviceWIth it to replace that last "to", as:

context.getRouteDefinition("rms-send-ping").adviceWith(context, new 
AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
weaveById("sendToRoma")
.replace()
.to("log:unit")
.to("mock:pingCheck");
}

The intention being to extract the message from the mocked end point and run 
some checks on it.
When the test runs, I see the output from the woven in "log:unit" then I have 
an error:

2016-04-28 18:42:33 ERROR JAXRSUtils:1788 - No message body writer has been 
found for class java.nio.HeapByteBuffer, ContentType: text/plain

Is mock only allowed to have text message bodies written to it?

My searching for info related to that error has turned up only issues related 
to CXF and REST and problems marshalling to XML/JSON. 

Thanks,
-Steve Huston


RE: Not seeing query params on REST DSL

2016-04-26 Thread Steve Huston
Ok, so what I'm trying to do won't work at this time?

I've been going through camel-restlet docs trying to get at what Claus was 
surely referring to as a solution ;-)

> -Original Message-
> From: John D. Ament [mailto:johndam...@apache.org]
> Sent: Tuesday, April 26, 2016 7:02 AM
> To: users@camel.apache.org
> Subject: Re: Not seeing query params on REST DSL
> 
> IMHO what Steve's describing is a pretty useful feature.  I created a JIRA
> - https://issues.apache.org/jira/browse/CAMEL-9914
> 
> I'll try to get to it pretty soon.
> 
> John
> 
> On Mon, Apr 25, 2016 at 2:28 PM Claus Ibsen <claus.ib...@gmail.com>
> wrote:
> 
> > That is for the api documentation.
> >
> > Its the camel-restlet component that does the actual mapping from
> > restlet to camel exchange/message.
> >
> > On Mon, Apr 25, 2016 at 7:59 PM, Steve Huston <shus...@riverace.com>
> > wrote:
> > > Ok, what registers the query param if this doesn't?
> > >
> > > restConfiguration().component("restlet").port(9000);
> > > rest("/asset")
> > >
> >
> .put("/{addr}/pong").param().name("id").type(RestParamType.query).endP
> > aram()
> > >.to("log:steve?showAll=true")
> > >.to("mock:result");
> > >
> > >> -Original Message-
> > >> From: John D. Ament [mailto:johndam...@apache.org]
> > >> Sent: Monday, April 25, 2016 1:52 PM
> > >> To: users@camel.apache.org
> > >> Subject: Re: Not seeing query params on REST DSL
> > >>
> > >> Apologies as I missed this.
> > >>
> > >> As far as I know, you need to explicitly register your query params.
> > They are
> > >> not automatically propagated.
> > >>
> > >> John
> > >>
> > >> On Mon, Apr 25, 2016 at 1:33 PM Steve Huston
> <shus...@riverace.com>
> > >> wrote:
> > >>
> > >> > On the risk of aggravating people (sorry) popping this up to
> > >> > today's content... any help is most welcome.
> > >> >
> > >> > Thanks!
> > >> > -Steve
> > >> >
> > >> > > -Original Message-
> > >> > > From: Steve Huston
> > >> > > Sent: Wednesday, April 20, 2016 8:57 PM
> > >> > > To: users@camel.apache.org
> > >> > > Subject: Re: Not seeing query params on REST DSL
> > >> > >
> > >> > > I am using Camel 2.16.3 and restlet.
> > >> > >
> > >> > > -Steve
> > >> > >
> > >> > > > On Apr 20, 2016, at 7:27 PM, John D. Ament
> > >> <johndam...@apache.org>
> > >> > > wrote:
> > >> > > >
> > >> > > > Steve
> > >> > > >
> > >> > > > Could you share your dependencies as well?  Which rest
> > >> > > > runtime are you using?
> > >> > > > On Apr 20, 2016 17:12, "Steve Huston" <shus...@riverace.com>
> > wrote:
> > >> > > >
> > >> > > >> I am using the REST DSL in a Camel SCR unit test. I have a
> > >> > > >> route (being
> > >> > > >> tested) that will initiate a http request at this URL:
> > >> > > >>
> > >> > > >>@Test
> > >> > > >>public void testRoutes() throws Exception {
> > >> > > >>context.addRoutes(new RouteBuilder() {
> > >> > > >>@Override
> > >> > > >>public void configure() throws Exception {
> > >> > > >>
> > >> > > >> restConfiguration().component("restlet").port(9000);
> > >> > > >>rest("/asset")
> > >> > > >>.put("/{addr}/pong")
> > >> > > >> .param().name("id").type(RestParamType.query).endParam()
> > >> > > >>.to("log:steve?showAll=true")
> > >> > > >>.to("mock:result");
> > >> > > >>}
> > >> > > >>});
> > >> > > >>
> > >> > > >>MockEndpoint resultEndpoint =
> > >> > > >> context.getEndpoint("mock:result",
> > >> > > >> MockEndpoint.class);
> > >> > > >>resultEndpoint.expectedMessageCount(1);
> > >> > > >>
> > >> > > >>
> > >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value")
> > >> ;
> > >> > > >>
> > >> > > >> resultEndpoint.message(0).header("id").isEqualTo("abcd1234")
> > >> > > >> ;
> > >> > > >>
> > >> > > >>
> > >> > > >> At run time, the request does arrive as a PUT to
> > >> > > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234
> > >> > > >>
> > >> > > >> However, I am only getting the "addr" path parameter in the
> > header.
> > >> > > >> The query param "id" is missing.
> > >> > > >> Am I doing something wrong on the definition? I pieced
> > >> > > >> together the way to do it from disparate tidbits on the net.
> > >> > > >>
> > >> > > >> Thanks,
> > >> > > >> -Steve
> > >> > > >>
> > >> >
> > >> >
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >


RE: Not seeing query params on REST DSL

2016-04-25 Thread Steve Huston
Ok, what registers the query param if this doesn't?

restConfiguration().component("restlet").port(9000);
rest("/asset")
   
.put("/{addr}/pong").param().name("id").type(RestParamType.query).endParam()
   .to("log:steve?showAll=true")
   .to("mock:result");

> -Original Message-
> From: John D. Ament [mailto:johndam...@apache.org]
> Sent: Monday, April 25, 2016 1:52 PM
> To: users@camel.apache.org
> Subject: Re: Not seeing query params on REST DSL
> 
> Apologies as I missed this.
> 
> As far as I know, you need to explicitly register your query params.  They are
> not automatically propagated.
> 
> John
> 
> On Mon, Apr 25, 2016 at 1:33 PM Steve Huston <shus...@riverace.com>
> wrote:
> 
> > On the risk of aggravating people (sorry) popping this up to today's
> > content... any help is most welcome.
> >
> > Thanks!
> > -Steve
> >
> > > -Original Message-
> > > From: Steve Huston
> > > Sent: Wednesday, April 20, 2016 8:57 PM
> > > To: users@camel.apache.org
> > > Subject: Re: Not seeing query params on REST DSL
> > >
> > > I am using Camel 2.16.3 and restlet.
> > >
> > > -Steve
> > >
> > > > On Apr 20, 2016, at 7:27 PM, John D. Ament
> <johndam...@apache.org>
> > > wrote:
> > > >
> > > > Steve
> > > >
> > > > Could you share your dependencies as well?  Which rest runtime are
> > > > you using?
> > > > On Apr 20, 2016 17:12, "Steve Huston" <shus...@riverace.com> wrote:
> > > >
> > > >> I am using the REST DSL in a Camel SCR unit test. I have a route
> > > >> (being
> > > >> tested) that will initiate a http request at this URL:
> > > >>
> > > >>@Test
> > > >>public void testRoutes() throws Exception {
> > > >>context.addRoutes(new RouteBuilder() {
> > > >>@Override
> > > >>public void configure() throws Exception {
> > > >>
> > > >> restConfiguration().component("restlet").port(9000);
> > > >>rest("/asset")
> > > >>.put("/{addr}/pong")
> > > >> .param().name("id").type(RestParamType.query).endParam()
> > > >>.to("log:steve?showAll=true")
> > > >>.to("mock:result");
> > > >>}
> > > >>});
> > > >>
> > > >>MockEndpoint resultEndpoint =
> > > >> context.getEndpoint("mock:result",
> > > >> MockEndpoint.class);
> > > >>resultEndpoint.expectedMessageCount(1);
> > > >>
> > > >>
> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value");
> > > >>
> > > >> resultEndpoint.message(0).header("id").isEqualTo("abcd1234");
> > > >>
> > > >>
> > > >> At run time, the request does arrive as a PUT to
> > > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234
> > > >>
> > > >> However, I am only getting the "addr" path parameter in the header.
> > > >> The query param "id" is missing.
> > > >> Am I doing something wrong on the definition? I pieced together
> > > >> the way to do it from disparate tidbits on the net.
> > > >>
> > > >> Thanks,
> > > >> -Steve
> > > >>
> >
> >


RE: Not seeing query params on REST DSL

2016-04-25 Thread Steve Huston
On the risk of aggravating people (sorry) popping this up to today's content... 
any help is most welcome.

Thanks!
-Steve

> -Original Message-
> From: Steve Huston
> Sent: Wednesday, April 20, 2016 8:57 PM
> To: users@camel.apache.org
> Subject: Re: Not seeing query params on REST DSL
> 
> I am using Camel 2.16.3 and restlet.
> 
> -Steve
> 
> > On Apr 20, 2016, at 7:27 PM, John D. Ament <johndam...@apache.org>
> wrote:
> >
> > Steve
> >
> > Could you share your dependencies as well?  Which rest runtime are you
> > using?
> > On Apr 20, 2016 17:12, "Steve Huston" <shus...@riverace.com> wrote:
> >
> >> I am using the REST DSL in a Camel SCR unit test. I have a route
> >> (being
> >> tested) that will initiate a http request at this URL:
> >>
> >>@Test
> >>public void testRoutes() throws Exception {
> >>context.addRoutes(new RouteBuilder() {
> >>@Override
> >>public void configure() throws Exception {
> >>
> >> restConfiguration().component("restlet").port(9000);
> >>rest("/asset")
> >>.put("/{addr}/pong")
> >> .param().name("id").type(RestParamType.query).endParam()
> >>.to("log:steve?showAll=true")
> >>.to("mock:result");
> >>}
> >>});
> >>
> >>MockEndpoint resultEndpoint =
> >> context.getEndpoint("mock:result",
> >> MockEndpoint.class);
> >>resultEndpoint.expectedMessageCount(1);
> >>
> >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value");
> >>resultEndpoint.message(0).header("id").isEqualTo("abcd1234");
> >>
> >>
> >> At run time, the request does arrive as a PUT to
> >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234
> >>
> >> However, I am only getting the "addr" path parameter in the header.
> >> The query param "id" is missing.
> >> Am I doing something wrong on the definition? I pieced together the
> >> way to do it from disparate tidbits on the net.
> >>
> >> Thanks,
> >> -Steve
> >>



Re: Not seeing query params on REST DSL

2016-04-20 Thread Steve Huston
I am using Camel 2.16.3 and restlet.

-Steve

> On Apr 20, 2016, at 7:27 PM, John D. Ament <johndam...@apache.org> wrote:
> 
> Steve
> 
> Could you share your dependencies as well?  Which rest runtime are you
> using?
> On Apr 20, 2016 17:12, "Steve Huston" <shus...@riverace.com> wrote:
> 
>> I am using the REST DSL in a Camel SCR unit test. I have a route (being
>> tested) that will initiate a http request at this URL:
>> 
>>@Test
>>public void testRoutes() throws Exception {
>>context.addRoutes(new RouteBuilder() {
>>@Override
>>public void configure() throws Exception {
>> 
>> restConfiguration().component("restlet").port(9000);
>>rest("/asset")
>>.put("/{addr}/pong")
>> .param().name("id").type(RestParamType.query).endParam()
>>.to("log:steve?showAll=true")
>>.to("mock:result");
>>}
>>});
>> 
>>MockEndpoint resultEndpoint = context.getEndpoint("mock:result",
>> MockEndpoint.class);
>>resultEndpoint.expectedMessageCount(1);
>> 
>> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value");
>>resultEndpoint.message(0).header("id").isEqualTo("abcd1234");
>> 
>> 
>> At run time, the request does arrive as a PUT to
>> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234
>> 
>> However, I am only getting the "addr" path parameter in the header. The
>> query param "id" is missing.
>> Am I doing something wrong on the definition? I pieced together the way to
>> do it from disparate tidbits on the net.
>> 
>> Thanks,
>> -Steve
>> 



Not seeing query params on REST DSL

2016-04-20 Thread Steve Huston
I am using the REST DSL in a Camel SCR unit test. I have a route (being tested) 
that will initiate a http request at this URL:

@Test
public void testRoutes() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
restConfiguration().component("restlet").port(9000);
rest("/asset")
.put("/{addr}/pong") 
.param().name("id").type(RestParamType.query).endParam()
.to("log:steve?showAll=true")
.to("mock:result");
}
});

MockEndpoint resultEndpoint = context.getEndpoint("mock:result", 
MockEndpoint.class);
resultEndpoint.expectedMessageCount(1);
resultEndpoint.message(0).header("addr").isEqualTo("my_test_value");
resultEndpoint.message(0).header("id").isEqualTo("abcd1234");


At run time, the request does arrive as a PUT to 
http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234

However, I am only getting the "addr" path parameter in the header. The query 
param "id" is missing.
Am I doing something wrong on the definition? I pieced together the way to do 
it from disparate tidbits on the net.

Thanks,
-Steve


RE: Using BeanInvocation in camel cxf

2015-11-17 Thread Steve Huston
I have this excerpt from a Camel route in blueprint XML:

  
 
 

  
   ...


> -Original Message-
> From: Kasim Sert (Ibtech-Software Infrastructure)
> [mailto:kasim.s...@ibtech.com.tr]
> Sent: Tuesday, November 17, 2015 4:23 AM
> To: users@camel.apache.org
> Subject: Using BeanInvocation in camel cxf
> 
> Hi,
> 
> I am trying to develop a framework to invoke different web services based
> on their db definitions of SEI names and web method names and parameters
> etc.
> 
> To make this I found how to generate and BeanInvocation object from
> current web service definition. However I could not find any example on how
> to invoke this beaninvocation object.
> 
> Should it be something like :
> 
> From(direct:start)
> .bean(BeanInvocation,"invoke")
> 
> When I try this I get null pointer and even I dont know if this is right way 
> to
> go.
> 
> Can anybody send an example usage on camel routes please ?
> 
> 
> [Facebook]  [Twitter]
> 
> 
> [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=17.11
> .201511:2300] date=17.11.201511:2300>
> 
> 
> Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z
> olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i
> ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu
> mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir
> garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun
> i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir.
> Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini 
> i?ermeyebilir.
> 
> The information contained in this e-mail (including any attachments)is
> confidential. It must not be disclosed to any person without our authority. If
> you are not the intended recipient, please delete it from your system
> immediately. IBTech A.S. makes no warranty as to the accuracy or
> completeness of any information contained in this message and hereby
> excludes any liability of any kind for the information contained therein or 
> for
> the information transmission, reception, storage or use of such in any way
> whatsoever. Any opinions expressed in this message are those of the author
> and may not necessarily reflect the opinions of IBTech A.S.


RE: How to access payload from REST 404 reply in cxfrs?

2015-11-10 Thread Steve Huston
I got this working... thank you to Sergey and Kalyan for your assistance. After 
following your trails around and learning some more, I found that the main 
issue was that I had defined the return type for my REST operation as String, 
so Camel was dutifully converting to that and I did not have a Response to get 
the code from. After I changed the return type from String to Response, things 
started working.

If it appears that I've got something confused still, I'm happy to hear about 
it. 

-Steve

> -Original Message-
> From: Steve Huston [mailto:shus...@riverace.com]
> Sent: Monday, November 02, 2015 6:36 PM
> To: users@camel.apache.org
> Subject: Re: How to access payload from REST 404 reply in cxfrs?
> 
> Thanks again, Sergey. I was able to register the provider using:
> 
>   class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
> 
> Then use it via:
> 
>  
> 
> However, it looks like there is no content available via the exception. Using
> the code:
> 
>InvocationTargetException exception =
> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
> InvocationTargetException.class);
>NotFoundException orig = (NotFoundException)(exception.getCause());
>CrewServiceDeniedError err =
> orig.getResponse().readEntity(CrewServiceDeniedError.class);
>logger.error("Incoming response: ", err.getReason());
>   logger.error("Incoming response (plain):",
> orig.getResponse().readEntity(String.class));
> 
> I get output at runtime:
> 
> [Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR
> my.module.ExceptionProcessor - Incoming response:
> [Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR
> my.module.ExceptionProcessor - Incoming response (plain):
> 
> So I'm back to wondering where the original payload from the REST 404
> response is. It gets logged from Camel as:
> 
> ID: 2
> Response-Code: 404
> Encoding: ISO-8859-1
> Content-Type: application/json
> Headers: {Accept=[application/json], breadcrumbId=[ID-Steves-MacBook-
> Pro-local-55129-1446506823854-1-7], content-type=[application/json],
> OriginalHeader=[{name=VerifyEmployeeRequest, version=1, scac=rraa,
> timeSent=null, uuid=abcd-1234}], pin=[1234], reason=[INIT],
> Server=[Jetty(9.2.11.v20150529)], transfer-encoding=[chunked], User-
> Agent=[Apache CXF 3.1.2]}
> Payload: { "employeeID": "bad-name", "reason": "id not found"
> }
> 
> 
> Thanks very much for any insight,
> 
> -Steve
> 
> > On Nov 2, 2015, at 3:52 PM, Sergey Beryozkin <sberyoz...@gmail.com>
> wrote:
> >
> >
> > As I said you will need to register a JAXRS provider capable of
> > converting it, though I'm not sure right now what the syntax is with
> > cxfrs:bean:webService, looks like from
> > http://camel.apache.org/cxf-bean-component.html
> >
> > it is something like
> > cxfrs:bean:webService?providers=#jackson
> >
> > Cheers, Sergey
> > On 02/11/15 18:02, Steve Huston wrote:
> >> Thank you very much for your quick help, Sergey!
> >> I tried your solution and now get the following exception:
> >>
> >> [Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR
> >> org.apache.cxf.jaxrs.utils.JAXRSUtils - No message body reader has
> >> been found for class my.class.path.CrewServiceDeniedError,
> >> ContentType: application/json
> >>
> >> The code I have is:
> >>
> >>InvocationTargetException exception =
> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
> InvocationTargetException.class);
> >>NotFoundException orig =
> (NotFoundException)(exception.getCause());
> >>CrewServiceDeniedError err =
> >> orig.getResponse().readEntity(CrewServiceDeniedError.class);
> >>
> >> I created this class for the payload:
> >>
> >> public class CrewServiceDeniedError {
> >>
> >>private String employeeID;
> >>private String reason;
> >>
> >>public String getEmployeeID()
> >>{ return employeeID; }
> >>public void setEmployeeID(String id)
> >>{ employeeID = id; }
> >>
> >>public String getReason()
> >>{ return reason; }
> >>public void setReason(String r)
> >>{ reason = r; }
> >> }
> >>
> >> -Steve
> >>
> >>> On Nov 2, 2015, at 11:24 AM, Sergey Beryozkin <sberyoz...@gmail.com>
> wrote:
> >>>
> >>> Hi
> >>> If you can access NotFoundException then what you can do next is to
> >&g

Re: How to access payload from REST 404 reply in cxfrs?

2015-11-03 Thread Steve Huston
Thank you for the idea, Kalyan, but that didn’t work.

Is it true that there’s no access to the payload one it’s touched? I can see 
the payload if no exception is thrown (e.g., a normal 200 response).

Thanks,
-Steve

> On Nov 3, 2015, at 1:56 AM, calyan.bandi  wrote:
> 
> Hi,
> 
> I am not sure if its works, but you can try enabling the option streamCache
> on the route from which the web service is invoked. When using cxfrs
> component with trace/debug enabled the payload (stream) received from server
> is flushed once it is displayed - be it in logs or in your application. In
> order to preserve it you can enable stream caching on the route.
> 
> Thanks,
> Kalyan
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-access-payload-from-REST-404-reply-in-cxfrs-tp5773325p5773336.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: How to access payload from REST 404 reply in cxfrs?

2015-11-02 Thread Steve Huston
Thank you very much for your quick help, Sergey!
I tried your solution and now get the following exception:

[Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR 
org.apache.cxf.jaxrs.utils.JAXRSUtils - No message body reader has been found 
for class my.class.path.CrewServiceDeniedError, ContentType: application/json

The code I have is:

InvocationTargetException exception = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
InvocationTargetException.class);
NotFoundException orig = (NotFoundException)(exception.getCause());
CrewServiceDeniedError err = 
orig.getResponse().readEntity(CrewServiceDeniedError.class);

I created this class for the payload:

public class CrewServiceDeniedError {

private String employeeID;
private String reason;

public String getEmployeeID()
{ return employeeID; }
public void setEmployeeID(String id)
{ employeeID = id; }

public String getReason()
{ return reason; }
public void setReason(String r)
{ reason = r; }
}

-Steve

> On Nov 2, 2015, at 11:24 AM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:
> 
> Hi
> If you can access NotFoundException then what you can do next is to do
> 
> ErrorInfo errorInfo = exception.getResponse().readEntity(ErrorInfo.class)
> 
> where ErrorInfo is a custom class capturing a JSON error response, you'd also 
> need to register Jackson or other provider to get it converted. Or read it as 
> String.class and parse manually
> 
> HTH, Sergey
> On 02/11/15 16:15, Steve Huston wrote:
>> I put this up on stackoverflow... if you have cxfrs expertise, could you 
>> please read this?
>> 
>> How to access payload from REST 404 response in Camel cxfrs?
>> http://stackoverflow.com/q/33445686/240342?sem=2
>> 
>> Thanks,
>> -Steve
>> 
> 



How to access payload from REST 404 reply in cxfrs?

2015-11-02 Thread Steve Huston
I put this up on stackoverflow... if you have cxfrs expertise, could you please 
read this?

How to access payload from REST 404 response in Camel cxfrs?
http://stackoverflow.com/q/33445686/240342?sem=2

Thanks,
-Steve


Re: How to access payload from REST 404 reply in cxfrs?

2015-11-02 Thread Steve Huston
Thanks again, Sergey. I was able to register the provider using:

 

However, it looks like there is no content available via the exception. Using 
the code:

   InvocationTargetException exception = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
InvocationTargetException.class);
   NotFoundException orig = (NotFoundException)(exception.getCause());
   CrewServiceDeniedError err = 
orig.getResponse().readEntity(CrewServiceDeniedError.class);
   logger.error("Incoming response: ", err.getReason());
logger.error("Incoming response (plain):", 
orig.getResponse().readEntity(String.class));

I get output at runtime:

[Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR 
my.module.ExceptionProcessor - Incoming response: 
[Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR 
my.module.ExceptionProcessor - Incoming response (plain):

So I’m back to wondering where the original payload from the REST 404 response 
is. It gets logged from Camel as:

ID: 2
Response-Code: 404
Encoding: ISO-8859-1
Content-Type: application/json
Headers: {Accept=[application/json], 
breadcrumbId=[ID-Steves-MacBook-Pro-local-55129-1446506823854-1-7], 
content-type=[application/json], OriginalHeader=[{name=VerifyEmployeeRequest, 
version=1, scac=rraa, timeSent=null, uuid=abcd-1234}], pin=[1234], 
reason=[INIT], Server=[Jetty(9.2.11.v20150529)], transfer-encoding=[chunked], 
User-Agent=[Apache CXF 3.1.2]}
Payload: { "employeeID": "bad-name", "reason": "id not found” 
}


Thanks very much for any insight,

-Steve

> On Nov 2, 2015, at 3:52 PM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:
> 
> 
> As I said you will need to register a JAXRS provider capable of converting 
> it, though I'm not sure right now what the syntax is with
> cxfrs:bean:webService, looks like from
> http://camel.apache.org/cxf-bean-component.html
> 
> it is something like
> cxfrs:bean:webService?providers=#jackson
> 
> Cheers, Sergey
> On 02/11/15 18:02, Steve Huston wrote:
>> Thank you very much for your quick help, Sergey!
>> I tried your solution and now get the following exception:
>> 
>> [Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR 
>> org.apache.cxf.jaxrs.utils.JAXRSUtils - No message body reader has been 
>> found for class my.class.path.CrewServiceDeniedError, ContentType: 
>> application/json
>> 
>> The code I have is:
>> 
>>InvocationTargetException exception = 
>> exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
>> InvocationTargetException.class);
>>NotFoundException orig = (NotFoundException)(exception.getCause());
>>CrewServiceDeniedError err = 
>> orig.getResponse().readEntity(CrewServiceDeniedError.class);
>> 
>> I created this class for the payload:
>> 
>> public class CrewServiceDeniedError {
>> 
>>private String employeeID;
>>private String reason;
>> 
>>public String getEmployeeID()
>>{ return employeeID; }
>>public void setEmployeeID(String id)
>>{ employeeID = id; }
>> 
>>public String getReason()
>>{ return reason; }
>>public void setReason(String r)
>>{ reason = r; }
>> }
>> 
>> -Steve
>> 
>>> On Nov 2, 2015, at 11:24 AM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:
>>> 
>>> Hi
>>> If you can access NotFoundException then what you can do next is to do
>>> 
>>> ErrorInfo errorInfo = exception.getResponse().readEntity(ErrorInfo.class)
>>> 
>>> where ErrorInfo is a custom class capturing a JSON error response, you'd 
>>> also need to register Jackson or other provider to get it converted. Or 
>>> read it as String.class and parse manually
>>> 
>>> HTH, Sergey
>>> On 02/11/15 16:15, Steve Huston wrote:
>>>> I put this up on stackoverflow... if you have cxfrs expertise, could you 
>>>> please read this?
>>>> 
>>>> How to access payload from REST 404 response in Camel cxfrs?
>>>> http://stackoverflow.com/q/33445686/240342?sem=2
>>>> 
>>>> Thanks,
>>>> -Steve
>>>> 
>>> 
>> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Talend Community Coders
> http://coders.talend.com/



Re: How to access payload from REST 404 reply in cxfrs?

2015-11-02 Thread Steve Huston
Thanks again, Sergey. I was able to register the provider using:

  

However, it looks like there is no content available via the exception. Using 
the code:

InvocationTargetException exception = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
InvocationTargetException.class);
NotFoundException orig = (NotFoundException)(exception.getCause());
CrewServiceDeniedError err = 
orig.getResponse().readEntity(CrewServiceDeniedError.class);
logger.error("Incoming response: ", err.getReason());
logger.error("Incoming response (plain):", 
orig.getResponse().readEntity(String.class));

I get output at runtime:

[Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR 
my.module.ExceptionProcessor - Incoming response: 
[Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR 
my.module.ExceptionProcessor - Incoming response (plain):

So I’m back to wondering where the original payload from the REST 404 response 
is. It gets logged from Camel as:

ID: 2
Response-Code: 404
Encoding: ISO-8859-1
Content-Type: application/json
Headers: {Accept=[application/json], 
breadcrumbId=[ID-Steves-MacBook-Pro-local-55129-1446506823854-1-7], 
content-type=[application/json], OriginalHeader=[{name=VerifyEmployeeRequest, 
version=1, scac=rraa, timeSent=null, uuid=abcd-1234}], pin=[1234], 
reason=[INIT], Server=[Jetty(9.2.11.v20150529)], transfer-encoding=[chunked], 
User-Agent=[Apache CXF 3.1.2]}
Payload: { "employeeID": "bad-name", "reason": "id not found” 
}


Thanks very much for any insight,

-Steve

> On Nov 2, 2015, at 3:52 PM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:
> 
> 
> As I said you will need to register a JAXRS provider capable of converting 
> it, though I'm not sure right now what the syntax is with
> cxfrs:bean:webService, looks like from
> http://camel.apache.org/cxf-bean-component.html
> 
> it is something like
> cxfrs:bean:webService?providers=#jackson
> 
> Cheers, Sergey
> On 02/11/15 18:02, Steve Huston wrote:
>> Thank you very much for your quick help, Sergey!
>> I tried your solution and now get the following exception:
>> 
>> [Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR 
>> org.apache.cxf.jaxrs.utils.JAXRSUtils - No message body reader has been 
>> found for class my.class.path.CrewServiceDeniedError, ContentType: 
>> application/json
>> 
>> The code I have is:
>> 
>> InvocationTargetException exception = 
>> exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
>> InvocationTargetException.class);
>> NotFoundException orig = (NotFoundException)(exception.getCause());
>> CrewServiceDeniedError err = 
>> orig.getResponse().readEntity(CrewServiceDeniedError.class);
>> 
>> I created this class for the payload:
>> 
>> public class CrewServiceDeniedError {
>> 
>> private String employeeID;
>> private String reason;
>> 
>> public String getEmployeeID()
>> { return employeeID; }
>> public void setEmployeeID(String id)
>> { employeeID = id; }
>> 
>> public String getReason()
>> { return reason; }
>> public void setReason(String r)
>> { reason = r; }
>> }
>> 
>> -Steve
>> 
>>> On Nov 2, 2015, at 11:24 AM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:
>>> 
>>> Hi
>>> If you can access NotFoundException then what you can do next is to do
>>> 
>>> ErrorInfo errorInfo = exception.getResponse().readEntity(ErrorInfo.class)
>>> 
>>> where ErrorInfo is a custom class capturing a JSON error response, you'd 
>>> also need to register Jackson or other provider to get it converted. Or 
>>> read it as String.class and parse manually
>>> 
>>> HTH, Sergey
>>> On 02/11/15 16:15, Steve Huston wrote:
>>>> I put this up on stackoverflow... if you have cxfrs expertise, could you 
>>>> please read this?
>>>> 
>>>> How to access payload from REST 404 response in Camel cxfrs?
>>>> http://stackoverflow.com/q/33445686/240342?sem=2
>>>> 
>>>> Thanks,
>>>> -Steve
>>>> 
>>> 
>> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Talend Community Coders
> http://coders.talend.com/



RE: [camel-cxf] using blueprint

2015-10-20 Thread Steve Huston
> I cannot find any examples for setting up camel-cxf using blueprint, can
> someone point me the right direction?
> The one I have found uses spring, is there a way to not use spring for this
> component?

This is a stripped down blueprint XML file that works. If I stripped too much 
and it doesn't make sense, please let me know and I'll try to help.


http://www.osgi.org/xmlns/blueprint/v1.0.0;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel-cxf="http://camel.apache.org/schema/blueprint/cxf;
   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
   http://www.osgi.org/xmlns/1.0.0/blueprint.xsd
   http://camel.apache.org/schema/blueprint/cxf
   
http://camel.apache.org/schema/cxf/camel-cxf-blueprint.xsd;>

  
  
  
  http://localhost:9000; 
serviceClass="com.my.co.WebService" loggingFeatureEnabled="true"/>

  http://camel.apache.org/schema/blueprint;>



  http://localhost:9000?matchOnUriPrefix=true"/>
  



  
  

  




RE: How to test routes when using another TestRunner

2015-10-15 Thread Steve Huston
I am a relative novice in this area, but I did have some tests running in 
Cucumber. To get the applicationcontext, see this stack overflow question: 
http://stackoverflow.com/questions/4914012/how-to-inject-applicationcontext-itself

Once you have that, you can get the CamelContext like:

CamelContext ctx = applicationContext.getBean("camel-context-name", 
CamelContext.class);

-Steve

> -Original Message-
> From: biphasic [mailto:gregorl...@neovahealth.co.uk]
> Sent: Thursday, October 15, 2015 12:01 PM
> To: users@camel.apache.org
> Subject: How to test routes when using another TestRunner
> 
> Hello,
> I have a few tests to check my Camel routes that when run using the
> SpringJUnit4ClassRunner work just fine. However, I want to test some routes
> of my application with Cucumber (basically something similar to JUnit). This
> requires me to use another TestRunner (Cucumber.class). When trying to call
> my tests from a Cucumber stack, the class that extends
> CamelSpringTestSupport will not set any form of context. It just skips
> createApplicationContext(). I am still able to access beans though.
> 
> What I now did as an ugly fix was to set the context manually.
> 
> this.context = new
> ClassPathXmlApplicationContext("classpath:context.xml").getBean("camelC
> ontext");
> 
> I can now send something to endpoints, can access beans and whatnot. But
> the assertion of expectedMessages at my MockEndpoint still always fails.
> 
> Is there something else that I manually have to recreate when extending
> CamelSpringTestSupport and I cannot use the SpringJUnitClassRunner?
> 
> Thankful for any hints,
> Cheers
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-
> test-routes-when-using-another-TestRunner-tp5772687.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Trouble getting AMQP going

2015-10-12 Thread Steve Huston
FYI, I got some advice from stackoverflow to change the bean id below from 
"amqpConnection" to "amqp" (matching the 'from' and 'to' prefixes in the route 
below) and that got me past this immediate problem. I submitted a JIRA for this 
issue.

-Steve

> -Original Message-----
> From: Steve Huston
> Sent: Thursday, October 08, 2015 1:47 PM
> To: users@camel.apache.org
> Subject: Trouble getting AMQP going
> 
> I am trying to use AMQP queues as both the start and end of a route. I am
> having trouble getting this to work, following the example at
> http://camel.apache.org/amqp.html
> 
> Could someone please point me in the right direction?
> Thank you,
> -Steve Huston
> 
> I am deploying this in a blueprint container in karaf.
> 
> My setup is:
> 
>class="org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl"
> factory-method="createFromURL">
> 
>   
> 
>class="org.apache.camel.component.jms.JmsComponent" >
> 
>   
> 
> ...
> 
> 
>   
>   
>   
>   
>   
>   
>   
> 
> 
> 
> When I start this in karaf I get:
> 2015-10-08 13:34:00,968 | ERROR | nsole user karaf | BlueprintCamelContext
> | 109 - org.apache.camel.camel-blueprint - 2.15.3 | Error occurred during
> starting Camel: CamelContext(myCamelContext) due connectionFactory
> must be specified
> 
> java.lang.IllegalArgumentException: connectionFactory must be specified
>   at
> org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:293)
>   at
> org.apache.camel.component.jms.JmsConfiguration.createConnectionFactor
> y(JmsConfiguration.java:1131)
>   at
> org.apache.camel.component.jms.JmsConfiguration.getConnectionFactory(J
> msConfiguration.java:485)
>   at
> org.apache.camel.component.jms.JmsConfiguration.createListenerConnecti
> onFactory(JmsConfiguration.java:1140)
>   at
> org.apache.camel.component.jms.JmsConfiguration.getListenerConnectionF
> actory(JmsConfiguration.java:504)
>   at
> org.apache.camel.component.jms.JmsConfiguration.configureMessageListe
> nerContainer(JmsConfiguration.java:967)
>   at
> org.apache.camel.component.jms.JmsConfiguration.createMessageListener
> Container(JmsConfiguration.java:448)
>   at
> org.apache.camel.component.jms.JmsEndpoint.createMessageListenerCont
> ainer(JmsEndpoint.java:184)
>   at
> org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoi
> nt.java:179)
>   at
> org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoi
> nt.java:71)
> ...
> 



Trouble getting AMQP going

2015-10-08 Thread Steve Huston
I am trying to use AMQP queues as both the start and end of a route. I am 
having trouble getting this to work, following the example at 
http://camel.apache.org/amqp.html

Could someone please point me in the right direction?
Thank you,
-Steve Huston

I am deploying this in a blueprint container in karaf.

My setup is:

  

  

  

  

...


  
  
  
  
  
  
  



When I start this in karaf I get:
2015-10-08 13:34:00,968 | ERROR | nsole user karaf | BlueprintCamelContext  
  | 109 - org.apache.camel.camel-blueprint - 2.15.3 | Error occurred during 
starting Camel: CamelContext(myCamelContext) due connectionFactory must be 
specified

java.lang.IllegalArgumentException: connectionFactory must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:293)
at 
org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1131)
at 
org.apache.camel.component.jms.JmsConfiguration.getConnectionFactory(JmsConfiguration.java:485)
at 
org.apache.camel.component.jms.JmsConfiguration.createListenerConnectionFactory(JmsConfiguration.java:1140)
at 
org.apache.camel.component.jms.JmsConfiguration.getListenerConnectionFactory(JmsConfiguration.java:504)
at 
org.apache.camel.component.jms.JmsConfiguration.configureMessageListenerContainer(JmsConfiguration.java:967)
at 
org.apache.camel.component.jms.JmsConfiguration.createMessageListenerContainer(JmsConfiguration.java:448)
at 
org.apache.camel.component.jms.JmsEndpoint.createMessageListenerContainer(JmsEndpoint.java:184)
at 
org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoint.java:179)
at 
org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoint.java:71)
...




RE: NoClassDefFoundError: net/minidev/json/parser/ContainerFactory

2015-08-25 Thread Steve Huston
Note that I got that dependency from the Camel site:
http://camel.apache.org/jsonpath.html

Is this a bug?

 -Original Message-
 From: shuston [mailto:shus...@riverace.com]
 Sent: Tuesday, August 25, 2015 3:11 PM
 To: users@camel.apache.org
 Subject: RE: NoClassDefFoundError:
 net/minidev/json/parser/ContainerFactory
 
 Ok, I found the source of the dual json-smart versions. My pom.xml listed:
 
 dependency
   groupIdorg.apache.camel/groupId
   artifactIdcamel-jsonpath/artifactId
   version${camel.version}/version
 /dependency
 
 And that was pulling in json-path 0.9.1 which pulled in json-smart 1.2.
 Once I removed the above camel-jsonpath dependency the older json-path
 is not pulled any longer. That problem is gone. Now I have a context problem
 in its place :-(  I will research that.
 
 Thank you for your help,
 
 -Steve Huston
 
 
 From: Steve Huston
 Sent: Tuesday, August 25, 2015 2:43 PM
 To: 'Aki Yoshida-3 [via Camel]' ml-
 node+s465427n5770969...@n5.nabble.com
 Subject: RE: NoClassDefFoundError:
 net/minidev/json/parser/ContainerFactory
 
 Thank you, Aki. I'm following this trail. For now, I've found that something 
 in
 my dependencies is pulling in both net.minidev.json-smart 1.2 and 2.1.1 -
 since I don't list json-smart explicitly, I'll need to chase through the 
 others to
 find the mismatch.
 
 From: Aki Yoshida-3 [via Camel] [mailto:ml-
 node+s465427n5770969...@n5.nabble.com]
 Sent: Tuesday, August 25, 2015 8:56 AM
 To: Steve Huston shus...@riverace.com
 Subject: Re: NoClassDefFoundError:
 net/minidev/json/parser/ContainerFactory
 
 you should check your project dependency to see which jayway you have.
 you seem to have some old version of jayway that is expecting json-smart-
 1.3.x.
 
 2015-08-24 17:00 GMT+02:00 shuston [hidden email]:
 
  This is for Camel 2.15.3 (also had the problem with 2.15.2)
 
  I am a new Camel user, and trying to use jsonpath. I have in my pom.xml:
 
      dependency
        groupIdorg.apache.camel/groupId
        artifactIdcamel-jsonpath/artifactId
        version${camel.version}/version
      /dependency
 
  In my XML config, I have:
      route
        from uri=seda:from_rraa/
        process ref=issPreprocessor/
        choice
          when
            jsonpath$.header[?(@.name ==
  VerifyEmployeeRequest)]/jsonpath
            unmarshal ref=VerifyEmployeeRequest/
          /when
        /choice
 
        process ref=crewMock/
        to uri=seda:to_rraa/
      /route
 
  I get at runtime (mvn test):
 
  java.lang.NoClassDefFoundError:
  net/minidev/json/parser/ContainerFactory
          at
  com.jayway.jsonpath.spi.impl.JsonSmartJsonProvider.init(JsonSmartJso
  nProvider.java:38)
          at
  com.jayway.jsonpath.spi.impl.JsonSmartJsonProvider.init(JsonSmartJso
  nProvider.java:41)
          at
  com.jayway.jsonpath.spi.JsonProviderFactory.clinit(JsonProviderFacto
  ry.java:24)
          at
  com.jayway.jsonpath.Configuration.defaultConfiguration(Configuration.j
  ava:62)
          at
  org.apache.camel.jsonpath.JsonPathEngine.init(JsonPathEngine.java:41
  )
          at
  org.apache.camel.jsonpath.JsonPathExpression.init(JsonPathExpression
  .java:33)
          at
 
 org.apache.camel.jsonpath.JsonPathLanguage.createPredicate(JsonPathLan
  guage.java:27)
  ...
 
  I tried adding this to my pom.xml:
      dependency
        groupIdnet.minidev/groupId
        artifactIdjson-smart/artifactId
        version2.1.1/version
      /dependency
 
  But that did not help.
 
  Can someone please help steer me in the right direction?
 
 
 
 
  --
  View this message in context:
  http://camel.465427.n5.nabble.com/NoClassDefFoundError-net-minidev-
 jso
  n-parser-ContainerFactory-tp5770943.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/NoClassDefFoundError-net-minidev-
 json-parser-ContainerFactory-tp5770943p5770969.html
 To unsubscribe from NoClassDefFoundError:
 net/minidev/json/parser/ContainerFactory, click here.
 NAML
 
 
 
 
 --
 View this message in context:
 http://camel.465427.n5.nabble.com/NoClassDefFoundError-net-minidev-
 json-parser-ContainerFactory-tp5770943p5770976.html
 Sent from the Camel - Users mailing list archive at Nabble.com.