Re: Processor data persistence during route stop

2024-06-06 Thread Mark Nuttall
This is just using one of the EIPs to handle your use case. Camel is just
EIPs wired together.

" Otherwise we will have to include DB related jars/code to do the same
what Camel already does."
You have to do that if you want to persist anything, Routes should not be
long running (i.e. break up the work using channels). If you do really have
this issue, then check out one of the EIPs or maybe use a workflow tool
along side Camel.




On Thu, Jun 6, 2024 at 8:00 AM Jan Bares, WOOD & Co.
 wrote:

> It would be nice to be able to use Camel routes for persistence, since we
> already persist other data this way. When route is about to be stopped,
> pass a special message to a route, that will persist processor data to
> database using Camel endpoint. And in the same way, when route is to be
> started, endpoint will read data from database and initialize the
> processor. Otherwise we will have to include DB related jars/code to do the
> same what Camel already does.
>
> Thank you, Jan
>
> > -Original Message-
> > From: Claus Ibsen 
> > Sent: Thursday, June 6, 2024 1:16 PM
> > To: users@camel.apache.org
> > Subject: Re: Processor data persistence during route stop
> >
> > Hi
> >
> > That is something you need to implement yourself to have this kind of
> > persistence. Your processor or beans can extend ServiceSupport (or
> > implement Service) from Camel then you have doStart/doStop methods that
> > Camel calls for you.
> >
> >
> > On Thu, Jun 6, 2024 at 11:18 AM Branko Husarik, Wood & Co.
> >  wrote:
> >
> > > Hello,
> > >
> > >
> > >
> > > I would like to ask about the proper saving and loading of processor
> > > variables to the database at the route stop. I am trying to use
> > > RoutePolicySupport to find out the system shutdown, but I don’t see any
> > > nice solution for how to persist the state of some processors that
> could be
> > > restored after startup.
> > >
> > > Please, can you give me tips? Thank you
> > >
> > >
> > >
> > > Best Regards
> > >
> > >
> > >
> > > Branko Husarik
> > >
> > >
> > >
> > > *Braňko Husárik*
> > > Calypso Developer
> > > IT Development
> > > email: branko.husa...@wood.cz
> > > m: +420 606 022 474
> > >
> > > WOOD & Company
> > > Palladium, nám. Republiky 1079/1a
> > > 110 00 Prague 1, Czech Republic
> > > wood.com
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > DISCLAIMER WOOD & Company Financial Services, a.s. and its branches are
> > > authorized and regulated by the CNB as Home State regulator and in
> Poland
> > > by the KNF, in Slovakia by the NBS, in Italy by the CONSOB and in the
> UK by
> > > the FCA as Host State regulators. For further information about WOOD &
> Co.,
> > > its investment services, financial instruments and associated risks,
> > > safeguard client assets (incl. compensation schemes) and contractual
> > > relationship please see our website at www.wood.com under section
> > > Corporate Governance. Unless otherwise stated, this transmission is
> neither
> > > an offer nor the solicitation of an offer to sell or purchase any
> > > investment. All estimates, opinions and other information contained
> herein
> > > are subject to change without notice and are provided in good faith but
> > > without legal responsibility or liability. Opinion may be personal to
> the
> > > author and may not reflect the opinions of WOOD & Co. Communications
> from
> > > sales persons, sales traders or traders should not be regarded as
> > > investment research and may contain opinions or trading ideas which are
> > > different from WOOD & Co. investment research opinions. This e-mail
> and any
> > > attachments are confidential and may be privileged or otherwise
> protected
> > > from disclosure. If you are not a named addressee you must not use,
> > > disclose, distribute, copy, print or rely on this e-mail and any of its
> > > attachments. Please notify the sender that you have received this
> email by
> > > mistake by replying to the email, and then delete the email and any
> copies
> > > of it. Although WOOD & Co. routinely screens e-mails for viruses,
> > > addressees should scan this e-mail and any attachments for viruses.
> WOOD &
> > > Co. makes no representation or warranty as to the absence of viruses in
> > > this e-mail or any attachments. Please note that to ensure regulatory
> > > compliance and for the protection of our clients and business, we may
> > > monitor and read e-mails sent to and from our server(s).
> > >
> >
> >
> > --
> > Claus Ibsen
> > -
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
>
> Jan Bares
> Head of Calypso development | IT Development
>
> Phone: +420 222 096 457
> Mobile: +420 776 333 676
> Email: jan.ba...@wood.cz
>
> WOOD & Company
> Palladium, nám. Republiky 1079/1a, 110 00 Prague 1, Czech Republic |
> wood.cz
>
>
>
>
>
> 
> DISCLAIMER
> WOOD & Company Financial Services, a.s. and its branches are 

Re: Camel 4 migration blog post - Feedback welcome

2023-10-06 Thread Mark Nuttall
one thing that got us was, since we were using kafka with security but not
using Kafka idempotency, we had to add the following flag. As usual, kafka
messages were not helpful.

camel.component.kafka.enable-idempotence=false

On Fri, Oct 6, 2023 at 3:49 AM Claus Ibsen  wrote:

> Hi
>
> If you have been migrating to Camel 4 already, then any feedback is
> welcome.
>
> You can comment in the PR, or post here in the mailing list
> https://github.com/apache/camel-website/pull/1071
>
>
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Camel Kafka consumer dynamic topic

2023-10-06 Thread Mark Nuttall
ya. was just saying you need a plan if you wanted to keep consuming the
route after restart.

anyway, like i said, you have all the pieces to do this. Anything more
would be writing it. But here is some pseudo code.

from(some Trigger)
   to(http) // get the topic
   bean(someServiceWithCamelContextInjected.class, "createRoute");

createRoute(theRestResponseStructure) {
// see stackoverflow link to create the route
}

On Fri, Oct 6, 2023 at 9:56 AM Chirag  wrote:

> Mark,
>
> Scenario for service restart will cause any dynamic route from being
> removed.
>
> It would require ReST to be idempotent and return or more complex -
> persisting routes and reloading them.
>
> ચિરાગ/चिराग/Chirag
> --
> Sent from My Gmail Account
>
>
> On Thu, Oct 5, 2023 at 12:44 AM Mark Nuttall  wrote:
> >
> > The link that I provided shows you how to dynamically create a new route.
> > So all you need to do is after you've called the rest in point using the
> > HTTP component you use what's returned to call a service method in some
> > Class via the bean EIP. The issue is that if the service restarts you
> will
> > lose anything dynamically created. The pieces are all there it's just a
> > matter of you putting them all together
> >
> > On Wed, Oct 4, 2023, 9:38 PM girish vasmatkar 
> wrote:
> >
> > > It's different to what my requirements are. I think dynamic routing in
> case
> > > of a Kafka consumer is different to the examples you have quoted.
> > >
> > > I can't have Kafka topic declared in property file or a yaml file for
> that
> > > matter because I wouldn't be knowing. In that case it would be pretty
> easy
> > > to just use property place holders and build the route
> > >
> > > I need to be able to get a random kafka topic at runtime and create a
> kafka
> > > consumer from it.
> > >
> > > - Girish
> > >
> > > On Wed, Oct 4, 2023, 2:58 AM Mark Nuttall  wrote:
> > >
> > > > Pretty sure I've done this kind of thing before. I think the info is
> here
> > > >
> > > >
> > >
> https://stackoverflow.com/questions/48380456/dynamic-routing-apache-camel
> > > >
> > > > On Tue, Oct 3, 2023, 3:22 AM Claus Ibsen 
> wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > If you use Java RouteBuilder, then you can maybe use spring
> dependency
> > > > > injection, to inject the topic name into a String field,
> > > > > and then use that field when building the route model.
> > > > >
> > > > > However I have also thought of adding {{bean:xxx?method=aaa}} as a
> > > > function
> > > > > to property placeholder.
> > > > > Though need to give it a bit more thought as this then have
> > > > > dependency ordering implication (bean must be created beforehand
> etc).
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Mon, Oct 2, 2023 at 12:40 PM girish vasmatkar <
> girish...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Dear Members,
> > > > > >
> > > > > > I have been searching for this for quite some time but haven't
> been
> > > > able
> > > > > to
> > > > > > figure out a way to do this.
> > > > > >
> > > > > > I need to subscribe to a kafka topic which I will know only at
> > > runtime
> > > > -
> > > > > by
> > > > > > calling a REST endpoint. The REST API I am calling is creating
> topics
> > > > and
> > > > > > returning the topic name.
> > > > > >
> > > > > > I am using spring camel starter and have camel route defined up
> > > until I
> > > > > am
> > > > > > able to fetch the topic name.  How do I then have a route
> created at
> > > > > > runtime that uses the topic name from the rest endpoint?
> > > > > >
> > > > > > --
> > > > > > Best,
> > > > > > Girish Vasmatkar
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Claus Ibsen
> > > > > -
> > > > > @davsclaus
> > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > > >
> > > >
> > >
>


Re: Camel Kafka consumer dynamic topic

2023-10-04 Thread Mark Nuttall
The link that I provided shows you how to dynamically create a new route.
So all you need to do is after you've called the rest in point using the
HTTP component you use what's returned to call a service method in some
Class via the bean EIP. The issue is that if the service restarts you will
lose anything dynamically created. The pieces are all there it's just a
matter of you putting them all together

On Wed, Oct 4, 2023, 9:38 PM girish vasmatkar  wrote:

> It's different to what my requirements are. I think dynamic routing in case
> of a Kafka consumer is different to the examples you have quoted.
>
> I can't have Kafka topic declared in property file or a yaml file for that
> matter because I wouldn't be knowing. In that case it would be pretty easy
> to just use property place holders and build the route
>
> I need to be able to get a random kafka topic at runtime and create a kafka
> consumer from it.
>
> - Girish
>
> On Wed, Oct 4, 2023, 2:58 AM Mark Nuttall  wrote:
>
> > Pretty sure I've done this kind of thing before. I think the info is here
> >
> >
> https://stackoverflow.com/questions/48380456/dynamic-routing-apache-camel
> >
> > On Tue, Oct 3, 2023, 3:22 AM Claus Ibsen  wrote:
> >
> > > Hi
> > >
> > > If you use Java RouteBuilder, then you can maybe use spring dependency
> > > injection, to inject the topic name into a String field,
> > > and then use that field when building the route model.
> > >
> > > However I have also thought of adding {{bean:xxx?method=aaa}} as a
> > function
> > > to property placeholder.
> > > Though need to give it a bit more thought as this then have
> > > dependency ordering implication (bean must be created beforehand etc).
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Mon, Oct 2, 2023 at 12:40 PM girish vasmatkar 
> > > wrote:
> > >
> > > > Dear Members,
> > > >
> > > > I have been searching for this for quite some time but haven't been
> > able
> > > to
> > > > figure out a way to do this.
> > > >
> > > > I need to subscribe to a kafka topic which I will know only at
> runtime
> > -
> > > by
> > > > calling a REST endpoint. The REST API I am calling is creating topics
> > and
> > > > returning the topic name.
> > > >
> > > > I am using spring camel starter and have camel route defined up
> until I
> > > am
> > > > able to fetch the topic name.  How do I then have a route created at
> > > > runtime that uses the topic name from the rest endpoint?
> > > >
> > > > --
> > > > Best,
> > > > Girish Vasmatkar
> > > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
> >
>


Re: Camel Kafka consumer dynamic topic

2023-10-03 Thread Mark Nuttall
Pretty sure I've done this kind of thing before. I think the info is here

https://stackoverflow.com/questions/48380456/dynamic-routing-apache-camel

On Tue, Oct 3, 2023, 3:22 AM Claus Ibsen  wrote:

> Hi
>
> If you use Java RouteBuilder, then you can maybe use spring dependency
> injection, to inject the topic name into a String field,
> and then use that field when building the route model.
>
> However I have also thought of adding {{bean:xxx?method=aaa}} as a function
> to property placeholder.
> Though need to give it a bit more thought as this then have
> dependency ordering implication (bean must be created beforehand etc).
>
>
>
>
>
>
>
>
> On Mon, Oct 2, 2023 at 12:40 PM girish vasmatkar 
> wrote:
>
> > Dear Members,
> >
> > I have been searching for this for quite some time but haven't been able
> to
> > figure out a way to do this.
> >
> > I need to subscribe to a kafka topic which I will know only at runtime -
> by
> > calling a REST endpoint. The REST API I am calling is creating topics and
> > returning the topic name.
> >
> > I am using spring camel starter and have camel route defined up until I
> am
> > able to fetch the topic name.  How do I then have a route created at
> > runtime that uses the topic name from the rest endpoint?
> >
> > --
> > Best,
> > Girish Vasmatkar
> >
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: How to receive Server side events

2023-08-15 Thread Mark Nuttall
https://www.baeldung.com/spring-server-sent-events

On Tue, Aug 15, 2023 at 4:00 PM Claus Ibsen  wrote:

> Hi
>
> There is no component that out of the box supports SSE with Camel (to my
> knowledge).
>
> We have a JIRA about this
> https://issues.apache.org/jira/browse/CAMEL-16431
>
> If you run in a runtime like Spring Boot or Quarkus then they may have some
> HTTP template you can use for SSE.
>
>
>
>
> On Tue, Aug 15, 2023 at 8:44 PM Andrew McCarron
>  wrote:
>
> > Greetings!
> > I'm fairly new to both java and Camel, and I've been tasked with
> > interfacing with a service that sends server side events.
> > The server is our own mock server app that I can run in the debugger.
> > I've tried to create a route that uses uri:http to connect to the service
> > with the following header settings.
> >
> >
> > @Component
> > public class GetCPE  extends RouteBuilder {
> > public void configure() throws Exception {
> > from("timer://getCPE?delay=2=1")
> > .routeId("get-cpe")
> > // Body is set by another route that gets an authorization token
> > .setHeader("Authorization", simple("Bearer ${body}"))
> > .process(exchange -> exchange.getIn().setBody(""))
> > .setHeader(Exchange.HTTP_METHOD,
> > constant(org.apache.camel.component.http.HttpMethods.GET))
> > .setHeader("Connection", simple("keep-alive"))
> > .setHeader("Accept", simple("text/event-stream"))
> > .setHeader("Accept-Encoding", simple("gzip, deflate, br"))
> > .setHeader("Postman-Token",
> > simple("6ec7dfb3-6a4e-46ad-9f29-329a854f2649"))
> > .to("http://localhost:5000/events;)
> > // so far, this is never called
> > .log("... response?");
> >
> > I know the GET request is received by the service, and that it generates
> > the events.
> > I've also used Postman to verify that the header settings are correct,
> and
> > that postman does receive the server events .
> >
> > Is http the correct way to receive events?
> > Are there other configuration or header settings to make http work?
> > Do I need to 'capture' each event somehow?
> >
> > Thanks in advance, Andy
> > ***
> > IMPORTANT MESSAGE FOR RECIPIENTS IN THE U.S.A.:
> > This message may constitute an advertisement of a BD group's products or
> > services or a solicitation of interest in them. If this is such a message
> > and you would like to opt out of receiving future advertisements or
> > solicitations from this BD group, please forward this e-mail to
> > optoutbygr...@bd.com. [BD.v1.0]
> > ***
> > This message (which includes any attachments) is intended only for the
> > designated recipient(s). It may contain confidential or proprietary
> > information and may be subject to the attorney-client privilege or other
> > confidentiality protections. If you are not a designated recipient, you
> may
> > not review, use, copy or distribute this message. If you received this in
> > error, please notify the sender by reply e-mail and delete this message.
> > Thank you.
> > ***
> > Corporate Headquarters Mailing Address: BD (Becton, Dickinson and
> Company)
> > 1 Becton Drive Franklin Lakes, NJ 07417 U.S.A.
> >
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Camel Kafka Consumer Node -1 disconnected error

2023-07-28 Thread Mark Nuttall
Yeah, typically most camel config is in properties. It looks like all the
config is on the URI and i dont see any security settings.
It is very highly likely what Claus said.
Or, your service does not have the correct access.

I have used Kafka with AWS MSK and Confluent and have seen this error
before. Typically it is security related.
Kafka is really bad about not giving you the correct info to figure out the
issue.


On Fri, Jul 28, 2023 at 9:35 AM Claus Ibsen  wrote:

> Hi
>
> There is no so much error details. Kafka is complex messaging system. And
> specially product systems are setup to be secured out of the box, and then
> you likely need to configure Camel Kafka for secured connection.
> Also try to google that error message bits you have and see what you can
> find on the internet.
>
>
>
> On Fri, Jul 28, 2023 at 3:03 PM Aditya Kavathekar <
> kavathekar.adi...@gmail.com> wrote:
>
> > Hi everyone I am trying to consume from a kafka topic and simply print
> the
> > body in logs. the code works when I try to connect to a local kafka topic
> > on localhost but I get error when I try to connect to dev1 kafka topic.
> >
> > In the logs I see after my code subscribes to the topic then I get these
> > errors Node -1 disconnected Canceled in-flight API_VERSIONS request with
> > correlation id 21 due to node -1 being disconnected (elapsed time since
> > creation: 131ms ...) Bootstrap broker (id: -1 rack: null) disconnected
> >
> > this is my code:
> >
> >
> from("kafka:mytopic?brokers=:9094==latest=org.apache.kafka.common.serialization.StringDeserializer=true=io.confluent.kafka.serializers.KafkaAvroDeserializer=:8081")
> > .log("Message is : ${body}");
> >
> > the  is a valid url which is confidential. the camel version is
> 3.2.0.
> >
> > I am getting the same error when I try to connect to kafka through core
> > java as well. Kindly help me
> >
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Consume Kafka messages in a batch

2023-03-22 Thread Mark Nuttall
Thanks Otavio!

Option 1 won't work because the Camel code, while it does consume a batch
based on those settings and iterates over the enumeration, it only ever
passes one at a time. I thought about hacking that class but when we update
camel versions, i'd have to remember i did that.  :) . We cannot use the
Aggregate EIP because the only real choice is in-memory and that has the
potential for data loss. Using an rdbms for the Aggregation does not work
in k8s and additionally we are trying to bulk update a db anyway.  Also,
the offset is not passed when, auto commit is on or off (forget which one)
and the correct combination to support aggregation, the value is not passed.

I will look at 2 again. I had dug in but it seemed to be pretty
complicated.  I did dig into the Spring code to see how they did it, but
that was complex and I ran out of time.

Mainly I didnt want to duplicate effort if anyone had started this. I know
you all are slammed.



On Wed, Mar 22, 2023 at 5:24 AM Otavio Rodolfo Piske 
wrote:

> Hi,
>
> Some ideas worth investigating:
>
> 1. Using a mix of current kafka client options (i.e.: like maxPollrecords,
> maxPollInterval, etc) along with aggregate EIP
> 2. Create your own KafkaClientFactory that wraps a custom Producer/Consumer
> wrapping the Spring Kafka Consumer.
>
> If none of this works, then I suggest opening a ticket with your
> suggestion. We have been pretty busy / overloaded with the work on Camel 4,
> so it's pretty easy for us to miss bug reports and interesting feature
> suggestions - as yours.If possible, try to provide a pseudo-code, a
> reproducer or a unit test that the community can look at and work with.
>
>
> Thanks
>
> On Wed, Mar 15, 2023 at 1:31 PM Mark Nuttall  wrote:
>
> > I know consuming Kafka messages in a batch is not currently supported. I
> > googled and I didn't find any real options.  I looked at hacking the
> Camel
> > classes to implement it and decided that it was too risky.
> >
> > So for now we are falling back to using a Spring Kafka Consumer. The
> issue
> > with that is I still want to use Camel because we need to do some complex
> > EIP processing and republishing of messages. And since Spring does not
> know
> > about Camel Context startup i have to do a hack to make it wait if the
> > CamelContext is not in the "started" state.
> >
> > Questions:
> >
> >- Is it possible to use the Spring Kafka Consumer in the "From" and be
> >managed by Camel (I think not but i figured i would ask).
> >- Is implementing batch consumers in the Kafka component planned/in
> >progress?
> >- If none of these - any ideas to make it work with the Kafka
> component?
> >
>
>
> --
> Otavio R. Piske
> http://orpiske.net
>


Consume Kafka messages in a batch

2023-03-15 Thread Mark Nuttall
I know consuming Kafka messages in a batch is not currently supported. I
googled and I didn't find any real options.  I looked at hacking the Camel
classes to implement it and decided that it was too risky.

So for now we are falling back to using a Spring Kafka Consumer. The issue
with that is I still want to use Camel because we need to do some complex
EIP processing and republishing of messages. And since Spring does not know
about Camel Context startup i have to do a hack to make it wait if the
CamelContext is not in the "started" state.

Questions:

   - Is it possible to use the Spring Kafka Consumer in the "From" and be
   managed by Camel (I think not but i figured i would ask).
   - Is implementing batch consumers in the Kafka component planned/in
   progress?
   - If none of these - any ideas to make it work with the Kafka component?


Re: How to trigger Messages at specific times

2023-02-01 Thread Mark Nuttall
The process that triggers calls producer template and publishes it to a
route. You definitely don't want to do the work as part of the trigger you
want to publish to a q u e u e or topic

On Tue, Jan 31, 2023, 10:44 PM Yash Ganthe  wrote:

> From Quartz that is set up outside of Camel, what do we need to do to
> trigger Camel?
>
> On Tue, 31 Jan 2023 at 21:51, Mark Nuttall  wrote:
>
> > Use quartz outside of camel and let camel do the rest. This is what we
> are
> > doing in a current product and I've done this before in the past.
> >
> > On Tue, Jan 31, 2023, 3:58 AM Yash Ganthe  wrote:
> >
> > > Hi,
> > >
> > > We have a DB table where every row has a text message and a timestamp.
> > E.g.
> > > Mesg1 09:00
> > > Mesg2 09:01
> > > Mesg3 09:15
> > > Mesg4 09:20
> > >
> > > The timings are not at a fixed interval. It is uneven. We would like to
> > > read the table as a Source and send the Messages to a Target at the
> > > configured timestamps. Components like Quartz do not allow configuring
> > > uneven trigger times.
> > >
> > > Is there a common pattern that can be followed for such a use case?
> > >
> > > Regards,
> > > Yash
> > >
> >
>


Re: How to trigger Messages at specific times

2023-01-31 Thread Mark Nuttall
Use quartz outside of camel and let camel do the rest. This is what we are
doing in a current product and I've done this before in the past.

On Tue, Jan 31, 2023, 3:58 AM Yash Ganthe  wrote:

> Hi,
>
> We have a DB table where every row has a text message and a timestamp. E.g.
> Mesg1 09:00
> Mesg2 09:01
> Mesg3 09:15
> Mesg4 09:20
>
> The timings are not at a fixed interval. It is uneven. We would like to
> read the table as a Source and send the Messages to a Target at the
> configured timestamps. Components like Quartz do not allow configuring
> uneven trigger times.
>
> Is there a common pattern that can be followed for such a use case?
>
> Regards,
> Yash
>


Re: Jdbc Aggregation and K8s

2022-03-11 Thread Mark Nuttall
Thanks Karen! We will. I will have my teammate do it since he is actually
working on the issue and has the details

On Fri, Mar 11, 2022 at 10:32 AM Karen Lease 
wrote:

> Hi Mark,
> This looks like a bug to me. During startup the AggregateProcessor first
> queries the exchange IDs in the table and then tries to read them using
> the IDs. So if the exchange completes between these 2 queries, the
> second select will return null.
> The AggregateProcessor should check for a null Exchange in this case
> before trying to defreference it.
> Would you like to create a JIRA issue?
>
> Regards,
> Karen Lease
>
> On 10/03/2022 23:30, Mark Nuttall wrote:
> > FYI we tried using ClusterJDBCAggregationRepository, but we can’t use
> > because it requires instance_id.
> > Also, our organization does not have support for StatefulSet so we can't
> > use that.
> >
> > On Thu, Mar 10, 2022 at 5:14 PM Mark Nuttall 
> wrote:
> >
> >> Sorry Claus, I should have included that. I was jumping back and forth
> on
> >> multiple things :(
> >>
> >> Camel 3.12.0 (using Java DSL)
> >> Spring Boot 2.5.5
> >> Java 11
> >>
> >> Thank you!
> >>
> >> On Thu, Mar 10, 2022 at 1:32 PM Claus Ibsen 
> wrote:
> >>
> >>> Hi
> >>>
> >>> What version of Camel do you use?
> >>>
> >>> On Thu, Mar 10, 2022 at 5:54 PM Mark Nuttall 
> wrote:
> >>>>
> >>>> Has anyone successfully gotten JDBC Aggregation to work with K8s
> >>>> (Kubernetes)?  We are struggling to make it work and maybe we are just
> >>>> missing something.
> >>>>
> >>>> Each instance  (pod) gets a list of aggregating exchanges, then
> >>> populates
> >>>> information about the exchanges, and if an exchange completes in
> between
> >>>> then the pods will fail to start.
> >>>>
> >>>> Here is the exception
> >>>>
> >>>> org.apache.camel.FailedToStartRouteException: Failed to start route
> >>>> receive-open-tracking-message because of null
> >>>>  at
> >>> org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123)
> >>>>  at
> >>>
> org.apache.camel.impl.engine.InternalRouteStartupManager.doWarmUpRoutes(InternalRouteStartupManager.java:306)
> >>>>  at
> >>>
> org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:189)
> >>>>  at
> >>>
> org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:147)
> >>>>  at
> >>>
> org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3198)
> >>>>  at
> >>>
> org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2862)
> >>>>  at
> >>>
> org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2813)
> >>>>  at
> >>>
> org.apache.camel.spring.boot.SpringBootCamelContext.doStart(SpringBootCamelContext.java:43)
> >>>>  at
> >>>
> org.apache.camel.support.service.BaseService.start(BaseService.java:119)
> >>>>  at
> >>>
> org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2509)
> >>>>  at
> >>>
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:246)
> >>>>  at
> >>>
> org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:119)
> >>>>  at
> >>>
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:151)
> >>>>  at
> >>>
> org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
> >>>>  at
> >>>
> org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
> >>>>  at
> >>>
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
> >>>>  at
> >>>
> org.springframework.context.support.Abs

Re: Jdbc Aggregation and K8s

2022-03-10 Thread Mark Nuttall
FYI we tried using ClusterJDBCAggregationRepository, but we can’t use
because it requires instance_id.
Also, our organization does not have support for StatefulSet so we can't
use that.

On Thu, Mar 10, 2022 at 5:14 PM Mark Nuttall  wrote:

> Sorry Claus, I should have included that. I was jumping back and forth on
> multiple things :(
>
> Camel 3.12.0 (using Java DSL)
> Spring Boot 2.5.5
> Java 11
>
> Thank you!
>
> On Thu, Mar 10, 2022 at 1:32 PM Claus Ibsen  wrote:
>
>> Hi
>>
>> What version of Camel do you use?
>>
>> On Thu, Mar 10, 2022 at 5:54 PM Mark Nuttall  wrote:
>> >
>> > Has anyone successfully gotten JDBC Aggregation to work with K8s
>> > (Kubernetes)?  We are struggling to make it work and maybe we are just
>> > missing something.
>> >
>> > Each instance  (pod) gets a list of aggregating exchanges, then
>> populates
>> > information about the exchanges, and if an exchange completes in between
>> > then the pods will fail to start.
>> >
>> > Here is the exception
>> >
>> > org.apache.camel.FailedToStartRouteException: Failed to start route
>> > receive-open-tracking-message because of null
>> > at
>> org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123)
>> > at
>> org.apache.camel.impl.engine.InternalRouteStartupManager.doWarmUpRoutes(InternalRouteStartupManager.java:306)
>> > at
>> org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:189)
>> > at
>> org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:147)
>> > at
>> org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3198)
>> > at
>> org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2862)
>> > at
>> org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2813)
>> > at
>> org.apache.camel.spring.boot.SpringBootCamelContext.doStart(SpringBootCamelContext.java:43)
>> > at
>> org.apache.camel.support.service.BaseService.start(BaseService.java:119)
>> > at
>> org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2509)
>> > at
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:246)
>> > at
>> org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:119)
>> > at
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:151)
>> > at
>> org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
>> > at
>> org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
>> > at
>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
>> > at
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
>> > at
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
>> > at
>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938)
>> > at
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
>> > at
>> org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
>> > at
>> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
>> > at
>> org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
>> > at
>> org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
>> > at
>> org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
>> > at
>> org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
>> > at
>> com.ac.campaign.CampaignsAggregatorApplication.main(CampaignsAggregatorApplication.java:12)
>> > at
>> java.base/jdk.internal.reflec

Re: Jdbc Aggregation and K8s

2022-03-10 Thread Mark Nuttall
Sorry Claus, I should have included that. I was jumping back and forth on
multiple things :(

Camel 3.12.0 (using Java DSL)
Spring Boot 2.5.5
Java 11

Thank you!

On Thu, Mar 10, 2022 at 1:32 PM Claus Ibsen  wrote:

> Hi
>
> What version of Camel do you use?
>
> On Thu, Mar 10, 2022 at 5:54 PM Mark Nuttall  wrote:
> >
> > Has anyone successfully gotten JDBC Aggregation to work with K8s
> > (Kubernetes)?  We are struggling to make it work and maybe we are just
> > missing something.
> >
> > Each instance  (pod) gets a list of aggregating exchanges, then populates
> > information about the exchanges, and if an exchange completes in between
> > then the pods will fail to start.
> >
> > Here is the exception
> >
> > org.apache.camel.FailedToStartRouteException: Failed to start route
> > receive-open-tracking-message because of null
> > at
> org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123)
> > at
> org.apache.camel.impl.engine.InternalRouteStartupManager.doWarmUpRoutes(InternalRouteStartupManager.java:306)
> > at
> org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:189)
> > at
> org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:147)
> > at
> org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3198)
> > at
> org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2862)
> > at
> org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2813)
> > at
> org.apache.camel.spring.boot.SpringBootCamelContext.doStart(SpringBootCamelContext.java:43)
> > at
> org.apache.camel.support.service.BaseService.start(BaseService.java:119)
> > at
> org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2509)
> > at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:246)
> > at
> org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:119)
> > at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:151)
> > at
> org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
> > at
> org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
> > at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
> > at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
> > at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
> > at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938)
> > at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
> > at
> org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
> > at
> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
> > at
> org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
> > at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
> > at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
> > at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
> > at
> com.ac.campaign.CampaignsAggregatorApplication.main(CampaignsAggregatorApplication.java:12)
> > at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > Source)
> > at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > Source)
> > at java.base/java.lang.reflect.Method.invoke(Unknown Source)
> > at
> org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
> > at
> org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
> > at
> org.springframework.boot.loader.Launc

Jdbc Aggregation and K8s

2022-03-10 Thread Mark Nuttall
Has anyone successfully gotten JDBC Aggregation to work with K8s
(Kubernetes)?  We are struggling to make it work and maybe we are just
missing something.

Each instance  (pod) gets a list of aggregating exchanges, then populates
information about the exchanges, and if an exchange completes in between
then the pods will fail to start.

Here is the exception

org.apache.camel.FailedToStartRouteException: Failed to start route
receive-open-tracking-message because of null
at 
org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123)
at 
org.apache.camel.impl.engine.InternalRouteStartupManager.doWarmUpRoutes(InternalRouteStartupManager.java:306)
at 
org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:189)
at 
org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:147)
at 
org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3198)
at 
org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2862)
at 
org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2813)
at 
org.apache.camel.spring.boot.SpringBootCamelContext.doStart(SpringBootCamelContext.java:43)
at 
org.apache.camel.support.service.BaseService.start(BaseService.java:119)
at 
org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2509)
at 
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:246)
at 
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:119)
at 
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:151)
at 
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at 
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at 
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938)
at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
at 
com.ac.campaign.CampaignsAggregatorApplication.main(CampaignsAggregatorApplication.java:12)
at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at 
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: org.apache.camel.RuntimeCamelException:
java.lang.NullPointerException
at 
org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:51)
at 
org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:67)
at 
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
at 
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:130)
at 
org.apache.camel.impl.engine.DefaultChannel.doStart(DefaultChannel.java:126)
at 
org.apache.camel.support.service.BaseService.start(BaseService.java:119)
at 
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
at 
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:116)
at 

Re: .process vs .to(bean: ?

2021-09-10 Thread Mark Nuttall
Yeah. That seems better. I wish the rest component supported to

On Friday, September 10, 2021, Steve Huston  wrote:

> 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;
>

Re: .process vs .to(bean: ?

2021-09-10 Thread Mark Nuttall
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 BufferedReader(new
> InputStreamReader(is));
> StringBuilder errReply = new StringBuilder();
> String responseLine = null;
> while ((responseLine = rd.readLine()) != null) {
>errReply.append(responseLine.trim());
> }
> rd.close();
> is.close();
> System.out.println(errReply);
>   }
>   client.close();
> }
> catch (Exception ex ) {
>   ex.printStackTrace();
> }
> }
>
> }
> [https://www.sun.ac.za/productionfooter/email/ProductionFooter.jpg]<
> 

Re: Springboot creating new Kakfa components

2021-07-16 Thread Mark Nuttall
Fyi, using Spring Boot and/or Camel, you can and should specify kafka
properties in property / yaml files. You dont need to create a Kafka
Component. Spring/Camel will do that for you. That is what they do. That
way it will be configured correctly.

https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.integration
https://camel.apache.org/camel-spring-boot/3.7.x/kafka-starter.html

On Thu, Jul 15, 2021 at 11:10 AM Ajmera, Hemang C 
wrote:

> Hi
>
>I am configuring kafka component using some default values configured
> via springboot configurations. This code works fine for camel 3.4.5,
> however it is not working with camel 3.11.0. I checked the migration
> documents, but didn’t find anything significant. When I check the output,
> kakfa is configured with default values and not with what I am providing.
> Here is the code which is used for configuration kafka component
>
>
>
> @Configuration
>
> @EnableConfigurationProperties(KafkaComponentProperties.class)
>
> public class KafkaComponentFactory {
>
>
>
> @Autowired(required = false)
>
> KafkaComponentProperties kafkaProp;
>
>
>
> @Bean("kafka")
>
> public KafkaComponent createKafkaComponent() throws KafkaException {
>
>
>
> KafkaComponent kafka = new KafkaComponent();
>
> KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
>
>
>
> kafkaConfiguration.setSaslMechanism(kafkaProp.getSaslMechanism());
>
>
>
> kafkaConfiguration.setSecurityProtocol(kafkaProp.getSecurityProtocol());
>
> kafkaConfiguration.setGroupId(kafkaProp.getGroupId());
>
> kafkaConfiguration.setBrokers(kafkaProp.getBrokers());
>
>
> kafkaConfiguration.setSslTruststorePassword(kafkaProp.getSslTruststorePassword());
>
>
> kafkaConfiguration.setSslKeystorePassword(kafkaProp.getSslKeystorePassword());
>
>
> kafkaConfiguration.setSslTruststoreLocation(kafkaProp.getSslTruststoreLocation());
>
>
> kafkaConfiguration.setSslKeystoreLocation(kafkaProp.getSslKeystoreLocation());
>
>
> kafkaConfiguration.setAutoCommitEnable(kafkaProp.getAutoCommitEnable());
>
>
> kafkaConfiguration.setAllowManualCommit(kafkaProp.getAllowManualCommit());
>
>
> kafkaConfiguration.setSslEndpointAlgorithm(kafkaProp.getSslEndpointAlgorithm());
>
>
>
> kafka.setConfiguration(kafkaConfiguration);
>
>
>
> System.setProperty("java.security.auth.login.config",
> kafkaProp.getKafkaClientConfigFilePath());
>
>
>
> return kafka;
>
>
>
> }
>
>
>
>
>
>
>
> Thanks and Regards,
>
> Hemang Ajmera
>
>
>
> *Hemang C Ajmera* | Technical Architect
>
> Asia Pacific Communications, Media and Utilities Delivery Center | CGI
>
> Block 5, DLF-SEZ, Manapakkam, Chennai – 600089, India
> O: +91-44-6647-3828 | M: +91-89397-07557 | M: +91-98841-66619 | VOIP:
> 8083828
>
> hemang.ajm...@cgi.com | www.cgi.com
>
> [image: Description: Description: Description: Description: Description:
> Description: Description:
> C:\Users\rahul.muthalali\AppData\Local\Microsoft\Windows\Temporary Internet
> Files\Content.Word\Top_Employer_India_English_2016.gif]
>
>
>


Re: Update Logging Levels of Camel routes using Spring Boot Actuator

2021-05-18 Thread Mark Nuttall
Yeah. This seems odd. I was looking at this on my phone last night so it
was tough to see but see what you are doing now.
Hopefully one of the Camel devs will know.

On Tue, May 18, 2021 at 5:43 AM Simon Loy  wrote:

> Thanks for responding Mark,
>
> To clarify I can change the logging level of the route to any level below
> and to the initial INFO level -  I can change between ERROR, WARN and INFO
> and see the requisite changes in the apps logging. This issue seems to
> arise whenever I want to raise it above INFO, for example updating the logs
> to DEBUG level, no DEBUG log lines are logged. This makes me think that
> there is a logger higher up in the hierarchy than the routes logger itself
> blocking it.
>
> For clarity my package structure looks like this
>
> - src
>   - main
> - java
>   - my.package
> - controllers
>   TestLoggersController.java
> - routes
>   TestLoggersRoute.java
> MyApplication.java
>
> Kind Regards
> Simon
>
> From: Mark Nuttall 
> Date: Tuesday, 18 May 2021 at 04:08
> To: users@camel.apache.org 
> Subject: Re: Update Logging Levels of Camel routes using Spring Boot
> Actuator
> CAUTION: This email originated from outside of the organisation. Do not
> click links or open attachments unless you recognise the sender and know
> the content is safe.
>
>
> It looks like your route Builder classes in the root package. That usually
> is not good as if that's the case. I suggest moving it to the same package
> as the controller. I don't know if that will make any difference but
> sometimes having classes in the root package causes issues. Other than that
> I can't see why things are not working. Other than Maybe because routes are
> created initially on Startup it's not sensing the logging level change
> which is weird. I'll have to confirm that tomorrow. Which is door today I
> think.
>
> On Mon, May 17, 2021, 1:08 PM Simon Loy  wrote:
>
> > Hi All,
> >
> > I’m currently working on a PoC to improve logging capabilities for our
> > Spring Boot applications.
> >
> > The idea is that setting up spring boot actuator allows us to update our
> > Camel routes logging levels without any downtime of manual config
> changes.
> >
> > As part of the PoC I have created a simple Spring Boot REST controller:
> >
> > @RestController
> > public class TestLoggersController {
> >
> >   private Logger logger = LoggerFactory.getLogger(this.getClass());
> >
> >   @EndpointInject(value = "direct:TestLoggersRoute")
> >   private ProducerTemplate producerTemplate;
> >
> >   @GetMapping("/testLogger")
> >   public ResponseEntity publishReconciledChannelDayAsRuns(){
> > logger.trace("Controller TRACE");
> > logger.debug("Controller DEBUG");
> > logger.info("Controller INFO");
> > logger.warn("Controller WARN");
> > logger.error("Controller ERROR");
> >
> > producerTemplate.sendBody("");
> >
> > return ResponseEntity.ok().build();
> >   }
> > }
> > and a Camel Route:
> >
> > @Component
> > public class TestLoggersRoute extends RouteBuilder {
> >   Logger logger = LoggerFactory.getLogger(this.getClass());
> >
> >   @Override
> >   public void configure() throws Exception {
> > from("direct:TestLoggersRoute").routeId("TestLoggersRoute")
> > .log(LoggingLevel.TRACE, "Route TRACE!")
> > .log(LoggingLevel.DEBUG, "Route DEBUG!")
> > .log(LoggingLevel.INFO, "Route INFO!")
> > .log(LoggingLevel.WARN, "Route WARN!")
> > .log(LoggingLevel.ERROR, "Route ERROR!");
> >   }
> > }
> > Nothing special going on, simple slf4j Logger for the REST Controller and
> > a standard log() within my route both with a log line for each level so I
> > had a decent range to test with
> >
> > After adding the relevant spring boot actuators dependencies
> >
> > 
> >  org.springframework.boot
> >  spring-boot-starter-actuator
> > 
> > and exposing/enabling the loggers endpoint
> >
> > management.endpoints.web.exposure.include=loggers
> > management.endpoint.loggers.enabled=true
> > I called my rest endpoint ‘0.0.0.0:80/testLogger’ to test connectivity
> > and I hadn’t messed up the basics. As expected I seen three log lines
> > printed for both the controller and routes; the ERROR, WARN and INFO log
> > lines.
> >
> > I then bumped the l

Re: Update Logging Levels of Camel routes using Spring Boot Actuator

2021-05-17 Thread Mark Nuttall
It looks like your route Builder classes in the root package. That usually
is not good as if that's the case. I suggest moving it to the same package
as the controller. I don't know if that will make any difference but
sometimes having classes in the root package causes issues. Other than that
I can't see why things are not working. Other than Maybe because routes are
created initially on Startup it's not sensing the logging level change
which is weird. I'll have to confirm that tomorrow. Which is door today I
think.

On Mon, May 17, 2021, 1:08 PM Simon Loy  wrote:

> Hi All,
>
> I’m currently working on a PoC to improve logging capabilities for our
> Spring Boot applications.
>
> The idea is that setting up spring boot actuator allows us to update our
> Camel routes logging levels without any downtime of manual config changes.
>
> As part of the PoC I have created a simple Spring Boot REST controller:
>
> @RestController
> public class TestLoggersController {
>
>   private Logger logger = LoggerFactory.getLogger(this.getClass());
>
>   @EndpointInject(value = "direct:TestLoggersRoute")
>   private ProducerTemplate producerTemplate;
>
>   @GetMapping("/testLogger")
>   public ResponseEntity publishReconciledChannelDayAsRuns(){
> logger.trace("Controller TRACE");
> logger.debug("Controller DEBUG");
> logger.info("Controller INFO");
> logger.warn("Controller WARN");
> logger.error("Controller ERROR");
>
> producerTemplate.sendBody("");
>
> return ResponseEntity.ok().build();
>   }
> }
> and a Camel Route:
>
> @Component
> public class TestLoggersRoute extends RouteBuilder {
>   Logger logger = LoggerFactory.getLogger(this.getClass());
>
>   @Override
>   public void configure() throws Exception {
> from("direct:TestLoggersRoute").routeId("TestLoggersRoute")
> .log(LoggingLevel.TRACE, "Route TRACE!")
> .log(LoggingLevel.DEBUG, "Route DEBUG!")
> .log(LoggingLevel.INFO, "Route INFO!")
> .log(LoggingLevel.WARN, "Route WARN!")
> .log(LoggingLevel.ERROR, "Route ERROR!");
>   }
> }
> Nothing special going on, simple slf4j Logger for the REST Controller and
> a standard log() within my route both with a log line for each level so I
> had a decent range to test with
>
> After adding the relevant spring boot actuators dependencies
>
> 
>  org.springframework.boot
>  spring-boot-starter-actuator
> 
> and exposing/enabling the loggers endpoint
>
> management.endpoints.web.exposure.include=loggers
> management.endpoint.loggers.enabled=true
> I called my rest endpoint ‘0.0.0.0:80/testLogger’ to test connectivity
> and I hadn’t messed up the basics. As expected I seen three log lines
> printed for both the controller and routes; the ERROR, WARN and INFO log
> lines.
>
> I then bumped the log level for the REST Controller up to ‘TRACE’ via curl
>
> curl -X "POST" "
> http://localhost:80/actuator/loggers/my.package.TestLoggersController; -H
> "Content-Type: application/json; charset=utf-8" -d $'{"configuredLevel":
> "TRACE"}'
>
> To confirm this worked I used the actuators GET method for loggers
>
> curl "
> 0.0.0.0:80/actuator/loggers/uk.co.uktv.gbt.asruns.controllers.TestLoggersController
> "
>
> which returned
> {
> "configuredLevel": "TRACE",
> "effectiveLevel": "TRACE"
> }
>
> Then, I called my REST controller and as expected I had eight log lines,
> five for the controller – a log line for each level on the test and the
> initial three log lines for the test route.
>
> I repeated the above curl statements but this time increasing the test
> routes logging level to ‘TRACE’ and checking that it had been updated in
> the actuator.
>
> curl -X "POST" "http://localhost:80/actuator/loggers/TestLoggersRoute; -H
> "Content-Type: application/json; charset=utf-8" -d $'{"configuredLevel":
> "TRACE"}'
>
> curl http://localhost:80/actuator/loggers/TestLoggersRoute which as
> expected returned:
> {
> "configuredLevel": "TRACE",
> "effectiveLevel": "TRACE"
> }
>
> However this time instead of seeing the expected ten log lines (ERROR,
> WARN, INFO, DEBUG & TRACE for both the REST controller and the test route)
> I only seen the same eight from the previous test after only changing the
> controller’s logging level.
>
> After a little playing around with the curl command I noticed that  I
> could lower the logging level within the camel routes to INFO, WARN, &
> ERROR successfully and only see the requisite log output. I then upped the
> default log level for the route by adding this to my application.properties
> file:
>
> logging.level.TestLoggersRoute=TRACE
> This allowed me to set the log level to any level and see the expected
> outputs, however this is far from ideal as I do not want to have to set all
> my routes to ‘TRACE’ level then have to instantly lower it after I spin the
> app up.
>
> Ideally I’d want the default log level to be INFO but be able to raise it
> up to ‘TRACE’ or ‘DEBUG’ without doing anything hacky in the
> 

Re: kafka consumer to kafka producer parition key issue

2021-04-19 Thread Mark Nuttall
Thanks Omar. I was looking at ProducerRecord because I was thinking about
trying to use Spring Kafka.

I am not sure yet, but part of the issue is that in the camel code, what is
being called the paritionKey is not. It is the partition (number). The docs
do the same thing. The partitionKey is a value that is converted by kafka
to determine the partition.

Ok so, yeah. I tested it. Setting just the KafkaConstants.KEY works.
There is no Kafka partition key and message key. There is only "Key".  It
is used for partitioning and compaction.
Only use the value in Camel called "KafkaConstants.PARTITION_KEY" if you
want to set it to a particular partition by number. The docs are correct in
that it is the partition the message will be assigned to.  There is also
constant called KafkaConstants.PARTITION but it is for consumers.

Thanks for helping me think through this Omar.
Mark

On Mon, Apr 19, 2021 at 12:05 PM Omar Al-Safi  wrote:

> Weird, from experience, I have seen this timeout happen if the specified
> partition doesn't exist.
>
> However, since you are using Camel 3.9 and you didn't set a message key,
> the partition key won't be set in the ProducerRecord, it will be only set
> if you set the message key, however this behavior has changed in Camel 3.10
> where the partition key won't require setting the message key. Thus, even
> if you set the partition key but you didn't set a message key, I will
> expect camel-kafka to ignore the partition (based on Camel 3.9) as you can
> see in this code
> <
> https://github.com/apache/camel/blob/camel-3.9.0/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java#L275
> >
> .
>
> How about if you try using camel-vertx-kafka
> <https://camel.apache.org/components/3.9.x/vertx-kafka-component.html>
> component
> and see if this solves the problem?
>
> Regards,
> Omar
>
> On Mon, Apr 19, 2021 at 5:26 PM Mark Nuttall  wrote:
>
> > Setting the message key does not help. :(
> >
> > On Mon, Apr 19, 2021 at 11:20 AM Mark Nuttall 
> wrote:
> >
> > > I've never set the message key.  I might give that a shot.
> > >
> > > The route is pretty simple. And the only headers being set are the
> > > partition key and another string value i need to be passed. The body is
> > > JSON.
> > > I am running Kafka locally (so whatever partitions is the default) and
> > AWS
> > > MSK -  2 partitions.
> > >
> > > Mark
> > >
> > >
> > >
> > > On Mon, Apr 19, 2021 at 4:14 AM Omar Al-Safi  wrote:
> > >
> > >> Hi Mark,
> > >>
> > >> When you send your message to Kafka, do you as well set the message
> key
> > or
> > >> you just set the partition key? Perhaps it would be great if you can
> > post
> > >> an example for your route with the headers/body that you set, that
> could
> > >> help us here to troubleshoot the issue. Also, how many partitions do
> you
> > >> have in your topic?
> > >>
> > >> Regards,
> > >> Omar
> > >>
> > >> On Fri, Apr 16, 2021 at 5:10 PM Mark Nuttall 
> > wrote:
> > >>
> > >> > Camel version: 3.9.0
> > >> >
> > >> > Issue: when consuming from one kafka topic and producing to another,
> > >> > setting the partition key causes the write to fail. After a few
> > seconds
> > >> it
> > >> > will fail with this error:
> > >> >
> > >> > Error during processing. Exchange[2729AA824AE4E97-].
> > >> Caused
> > >> > by: [org.apache.kafka.common.errors.TimeoutException - Topic
> > some-topic
> > >> not
> > >> > present in metadata after 6 ms.]
> > >> >
> > >> > The topic does exist. If i produce to the topic without the
> partition
> > >> key
> > >> > OR I produce to the topic with a partition key via the
> > producerTemplate
> > >> it
> > >> > works just fine.
> > >> > I am pretty sure in the past i have done this and it worked.
> > >> >
> > >> > Has anyone else seen this? Any ideas? I do have a work around (i.e.
> > use
> > >> > Spring's kafkaTemplate.).
> > >> >
> > >> > Mark
> > >> >
> > >>
> > >
> >
>


Re: kafka consumer to kafka producer parition key issue

2021-04-19 Thread Mark Nuttall
Setting the message key does not help. :(

On Mon, Apr 19, 2021 at 11:20 AM Mark Nuttall  wrote:

> I've never set the message key.  I might give that a shot.
>
> The route is pretty simple. And the only headers being set are the
> partition key and another string value i need to be passed. The body is
> JSON.
> I am running Kafka locally (so whatever partitions is the default) and AWS
> MSK -  2 partitions.
>
> Mark
>
>
>
> On Mon, Apr 19, 2021 at 4:14 AM Omar Al-Safi  wrote:
>
>> Hi Mark,
>>
>> When you send your message to Kafka, do you as well set the message key or
>> you just set the partition key? Perhaps it would be great if you can post
>> an example for your route with the headers/body that you set, that could
>> help us here to troubleshoot the issue. Also, how many partitions do you
>> have in your topic?
>>
>> Regards,
>> Omar
>>
>> On Fri, Apr 16, 2021 at 5:10 PM Mark Nuttall  wrote:
>>
>> > Camel version: 3.9.0
>> >
>> > Issue: when consuming from one kafka topic and producing to another,
>> > setting the partition key causes the write to fail. After a few seconds
>> it
>> > will fail with this error:
>> >
>> > Error during processing. Exchange[2729AA824AE4E97-].
>> Caused
>> > by: [org.apache.kafka.common.errors.TimeoutException - Topic some-topic
>> not
>> > present in metadata after 6 ms.]
>> >
>> > The topic does exist. If i produce to the topic without the partition
>> key
>> > OR I produce to the topic with a partition key via the producerTemplate
>> it
>> > works just fine.
>> > I am pretty sure in the past i have done this and it worked.
>> >
>> > Has anyone else seen this? Any ideas? I do have a work around (i.e. use
>> > Spring's kafkaTemplate.).
>> >
>> > Mark
>> >
>>
>


Re: kafka consumer to kafka producer parition key issue

2021-04-19 Thread Mark Nuttall
I've never set the message key.  I might give that a shot.

The route is pretty simple. And the only headers being set are the
partition key and another string value i need to be passed. The body is
JSON.
I am running Kafka locally (so whatever partitions is the default) and AWS
MSK -  2 partitions.

Mark



On Mon, Apr 19, 2021 at 4:14 AM Omar Al-Safi  wrote:

> Hi Mark,
>
> When you send your message to Kafka, do you as well set the message key or
> you just set the partition key? Perhaps it would be great if you can post
> an example for your route with the headers/body that you set, that could
> help us here to troubleshoot the issue. Also, how many partitions do you
> have in your topic?
>
> Regards,
> Omar
>
> On Fri, Apr 16, 2021 at 5:10 PM Mark Nuttall  wrote:
>
> > Camel version: 3.9.0
> >
> > Issue: when consuming from one kafka topic and producing to another,
> > setting the partition key causes the write to fail. After a few seconds
> it
> > will fail with this error:
> >
> > Error during processing. Exchange[2729AA824AE4E97-].
> Caused
> > by: [org.apache.kafka.common.errors.TimeoutException - Topic some-topic
> not
> > present in metadata after 6 ms.]
> >
> > The topic does exist. If i produce to the topic without the partition key
> > OR I produce to the topic with a partition key via the producerTemplate
> it
> > works just fine.
> > I am pretty sure in the past i have done this and it worked.
> >
> > Has anyone else seen this? Any ideas? I do have a work around (i.e. use
> > Spring's kafkaTemplate.).
> >
> > Mark
> >
>


kafka consumer to kafka producer parition key issue

2021-04-16 Thread Mark Nuttall
Camel version: 3.9.0

Issue: when consuming from one kafka topic and producing to another,
setting the partition key causes the write to fail. After a few seconds it
will fail with this error:

Error during processing. Exchange[2729AA824AE4E97-]. Caused
by: [org.apache.kafka.common.errors.TimeoutException - Topic some-topic not
present in metadata after 6 ms.]

The topic does exist. If i produce to the topic without the partition key
OR I produce to the topic with a partition key via the producerTemplate it
works just fine.
I am pretty sure in the past i have done this and it worked.

Has anyone else seen this? Any ideas? I do have a work around (i.e. use
Spring's kafkaTemplate.).

Mark


Re: Camel Springboot + telegraf-plugin + Grafana

2021-03-30 Thread Mark Nuttall
It directly into influxdb

On Tue, Mar 30, 2021, 4:54 PM SRIKANT MVS  wrote:

> Thanks Mark, Let me look into the springboot metrics.
>
> -Regards
> Srikant
>
> On Tue, Mar 30, 2021 at 7:07 PM Mark Nuttall  wrote:
>
> > Also if you are using routes to call Kafka or external http or whatever
> > then you will have metrics for that provided by camel metrics
> >
> > On Mon, Mar 29, 2021, 6:05 PM SRIKANT MVS  wrote:
> >
> > > Hi Team,
> > > I want to send metrics from my camel-springboot application to
> > > telegraf-plugins which would further be visible in the Grafana
> dashboard.
> > > This action should happen periodically.
> > >
> > > I have gone through the documentation and have enabled
> *camel-management*
> > > and *camel-metrics* dependency for sending jmx metrics.
> > > I can see the metrics in jconsole for verification purposes.
> > >
> > > But, I would like to understand how to send these metrics from a
> > > camel application.
> > >
> > > Is there a support in camel for this or should I use the spring-boot
> > > actuator.
> > >
> > > Additionally, I would also want to calculate the response time for
> > calling
> > > external systems like MQ, Kafka or any web server.
> > >
> > > Please share your thoughts on this.
> > >
> > > -Regards
> > > Srikant Mantha
> > >
> >
>


Re: Camel Springboot + telegraf-plugin + Grafana

2021-03-30 Thread Mark Nuttall
Also if you are using routes to call Kafka or external http or whatever
then you will have metrics for that provided by camel metrics

On Mon, Mar 29, 2021, 6:05 PM SRIKANT MVS  wrote:

> Hi Team,
> I want to send metrics from my camel-springboot application to
> telegraf-plugins which would further be visible in the Grafana dashboard.
> This action should happen periodically.
>
> I have gone through the documentation and have enabled *camel-management*
> and *camel-metrics* dependency for sending jmx metrics.
> I can see the metrics in jconsole for verification purposes.
>
> But, I would like to understand how to send these metrics from a
> camel application.
>
> Is there a support in camel for this or should I use the spring-boot
> actuator.
>
> Additionally, I would also want to calculate the response time for calling
> external systems like MQ, Kafka or any web server.
>
> Please share your thoughts on this.
>
> -Regards
> Srikant Mantha
>


Re: Camel Springboot + telegraf-plugin + Grafana

2021-03-30 Thread Mark Nuttall
You should use spring boots metrics support

On Mon, Mar 29, 2021, 6:05 PM SRIKANT MVS  wrote:

> Hi Team,
> I want to send metrics from my camel-springboot application to
> telegraf-plugins which would further be visible in the Grafana dashboard.
> This action should happen periodically.
>
> I have gone through the documentation and have enabled *camel-management*
> and *camel-metrics* dependency for sending jmx metrics.
> I can see the metrics in jconsole for verification purposes.
>
> But, I would like to understand how to send these metrics from a
> camel application.
>
> Is there a support in camel for this or should I use the spring-boot
> actuator.
>
> Additionally, I would also want to calculate the response time for calling
> external systems like MQ, Kafka or any web server.
>
> Please share your thoughts on this.
>
> -Regards
> Srikant Mantha
>


Re: Properties in java config

2021-03-18 Thread Mark Nuttall
Based on what you've said, this is a Spring Boot related (ish) issue only
because it is loading the properties. I suggest doing this the Spring Boot
way and letting the Spring Boot/Apache Camel integration just work. If
you've not see how Spring Boot resolves properties -
https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config

On Wed, Mar 17, 2021 at 3:33 PM Jared Whiklo  wrote:

> I apologize if this is either a) obvious or b) un-diagnosable because
> it's my local setup.
>
> I am working on converting an OSGI camel route to work in a deployable jar.
>
> I am using spring-boot and decided to also switch to use java config.
>
> My configuration class basically looks like.
>
> @PropertySources({
>  @PropertySource(value = "file:${indexer.config.file}",
> ignoreResourceNotFound = true),
>  @PropertySource(value = "classpath:default.yml")
> })
> @Configuration
> public class IndexerProps { }
>
> This seems to work for any variables injected using @PropertyInject but
> not necessarily for the {{property.name}} replacement.
>
> But what is really confused me is that I am able to compile and run the
> jar on my (Mac) laptop but when I move it to a development environment
> it no longer resolves any of the properties.
>
> So when I run the jar locally (using java 11.0.3) I get
>
> ---
>  > java -Dfc3indexer.config.file=local.properties
> -Dfc3indexer.log.indexer=DEBUG -Dfc3indexer.log.camel=DEBUG -jar
> build/libs/islandora-1x-solr-indexer-0.0.1.jar
>
>.     ___ _ _
>   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
> ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
>   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
>'  || .__|_| |_|_| |_\__, | / / / /
>   =|_|==|___/=/_/_/_/
>   :: Spring Boot ::(v2.3.3.RELEASE)
>
> INFO 12:35:39.404 (FedoraSolrIndexer) Starting FedoraSolrIndexer on
> whiklojlib-2.local with PID 89898
> (/Users/whikloj/www/DAM/islandora-1x-solr-indexer/build/libs/islandora-1x-solr-indexer-0.0.1.jar
>
> started by whikloj in /Users/whikloj/www/DAM/islandora-1x-solr-indexer)
> DEBUG 12:35:39.407 (FedoraSolrIndexer) Running with Spring Boot
> v2.3.3.RELEASE, Spring v5.2.8.RELEASE
> INFO 12:35:39.408 (FedoraSolrIndexer) No active profile set, falling
> back to default profiles: default
> DEBUG 12:35:41.190 (BeanConfig) brokerUrl is tcp://localhost:61616
> DEBUG 12:35:41.192 (BeanConfig) jms username/password is  /
> DEBUG 12:35:41.214 (BeanConfig) brokerUrl is tcp://localhost:61616
> DEBUG 12:35:41.214 (BeanConfig) jms username/password is  /
> DEBUG 12:35:41.252 (BeanConfig) brokerUrl is tcp://localhost:61616
> DEBUG 12:35:41.253 (BeanConfig) jms username/password is  /
> DEBUG 12:35:41.960 (FedoraSolrIndexer) Properyy injected xslt.path is
> file:///Users/whikloj/www/DAM/UofM_gsearch_config
> WARN 12:35:43.329 (JettyHttpComponent) You use localhost interface! It
> means that no external connections will be available. Don't you want to
> use 0.0.0.0 instead (all network interfaces)?
> jetty:
> http://localhost:/fedora3-solr-indexer/reindex/%7Bpid%7D?httpMethodRestrict=GET
> INFO 12:35:43.481 (FedoraSolrIndexer) Started FedoraSolrIndexer in 9.79
> seconds (JVM running for 11.033)
> ^C%
> 
>
> Which is good, but when I move the same jar to a (Linux RHEL)
> development server and run it (with java 11.0.10) I get
>
> 
> [whikloj@niobe]~% java -Dfc3indexer.log.islandora=DEBUG
> -Dfc3indexer.log.camel=DEBUG -Dfc3indexer.config.file=local.properties
> -jar islandora-1x-solr-indexer-0.0.1.jar
>
>.     ___ _ _
>   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
> ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
>   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
>'  || .__|_| |_|_| |_\__, | / / / /
>   =|_|==|___/=/_/_/_/
>   :: Spring Boot ::(v2.3.3.RELEASE)
>
> INFO 08:36:11.885 (FedoraSolrIndexer) Starting FedoraSolrIndexer on
> niobe with PID 14896
> (/home/u5/whikloj/islandora-1x-solr-indexer-0.0.1.jar started by whikloj
> in /home/u5/whikloj)
> INFO 08:36:11.888 (FedoraSolrIndexer) No active profile set, falling
> back to default profiles: default
> ERROR 08:36:15.557 (SpringApplication) Application run failed
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> fedora-foxml-properties at: >>>
> To[xslt:{{xslt.path}}/FOXML.xslt?transformerFactory=#xsltTransformer]
> <<< in route:
> Route(fedora-foxml-properties)[From[direct:fedora.properties... because
> of Failed to resolve endpoint:
> xslt:///FOXML.xslt?transformerFactory=#xsltTransformer due to:
> javax.xml.transform.TransformerException: java.io.FileNotFoundException:
> Cannot find resource: classpath:/FOXML.xslt in classpath for URI:
> classpath:/FOXML.xslt
>  at
> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:385)
>  at
> org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:112)
>
> ... 

Re: EXTERNAL: Re: Can't get routes to Start in SpringBoot / Camel 3.5.0

2021-01-08 Thread Mark Nuttall
OK good! Based on what i saw, that was the only thing left i could think of.

On Thu, Jan 7, 2021 at 2:33 PM Cox, Jeremy  wrote:

> The package structure was the problem.
>
> I created a package "routes" underneath where the application is, and put
> my route there.
> Thank you very much!
>
> Sincerely,
>
> Jeremy Cox
> Software Engineer
> Universal Gateway at Progeny Systems
>
> Urgent contact: Text 859.322.3214
> Emailjeremy@progeny.net
>
>
> -Original Message-
> From: Mark Nuttall [mailto:mknutt...@gmail.com]
> Sent: Thursday, January 7, 2021 1:55 PM
> To: users@camel.apache.org
> Subject: Re: EXTERNAL: Re: Can't get routes to Start in SpringBoot / Camel
> 3.5.0
>
> External E-mail --- CAUTION: This email originated from outside Progeny
> Systems. Do not click links or open attachments unless you recognize the
> sender and know the content is safe.
>
> Did you try something simple like a direct route? If that does work and
> the quartz one doesn't work then it is configured wrong.
> If neither do, try ensuring the Component is being created. Put a log
> statement in the configure method.
> I don't see the package names in your code  but if "beans" are not in
> the package or child package of where teh app class is, it wont find it by
> default.
>
> Mark
>
> On Thu, Jan 7, 2021 at 10:02 AM Cox, Jeremy 
> wrote:
>
> > Thank you all for the tips.  These are good improvements, but the
> > route still doesn't start.
> >
> > Adding to application.properties
> >
> > camel.springboot.main-run-controller = true
> >
> > prevents the program from shutting down, but the route still does not
> > start.
> >
> >
> > I also added quartz dependency.  I verified that jars were added to
> > the final jar with the dependency.
> >
> >
> > Sincerely,
> >
> > Jeremy Cox
> > Software Engineer
> > Universal Gateway at Progeny Systems
> >
> > Urgent contact: Text 859.322.3214
> > Emailjeremy@progeny.net
> >
> >
> > -Original Message-
> > From: Jared Whiklo [mailto:jwhi...@gmail.com]
> > Sent: Thursday, January 7, 2021 9:36 AM
> > To: users@camel.apache.org
> > Subject: EXTERNAL: Re: Can't get routes to Start in SpringBoot / Camel
> > 3.5.0
> >
> > External E-mail --- CAUTION: This email originated from outside
> > Progeny Systems. Do not click links or open attachments unless you
> > recognize the sender and know the content is safe.
> >
> > Hey Jeremy,
> >
> > I just did something similar and while I'm not done I've learned some
> > things.
> >
> > I would guess you need to add the application property defined here to
> > keep your routes running.
> >
> >
> > https://camel.apache.org/camel-spring-boot/latest/index.html#_making_s
> > ure_camel_context_is_running_in_standalone_spring_boot
> >
> > Cheers,
> > Jared
> >
> > On Thu., Jan. 7, 2021, 08:09 Cox, Jeremy, 
> wrote:
> >
> > > I am trying to port a project from Spring/Camel 2  to Spring Boot /
> > > Camel 3.  The routes won't start.  I've tried everything I can think
> > > of/ find on google search.
> > >
> > > 1. I went to start.spring.io and generated a project template.  I
> > > commented out the dependencies I am not using yet: jpa, hibernate, etc.
> > > 2. I added a test route.
> > > 3. I compiled and ran program.
> > > 4. My route did not start.
> > >
> > > I am not sure what is going on.  I have compared to code examples,
> > > and everything I have seems correct. I'm hoping I am missing
> > > something
> > simple.
> > > I'm also hoping for a sanity check -- should this be working?
> > >
> > > I have expanded on this basic start and got my hibernate and SQL
> > > databases to connect.  I just can't get the routes to start.
> > >
> > > I am developing using Redhat 7.6 / OpenJDK 11.  Also deploying
> > > Alpine
> > > 3.10 with Java 11.  (OpenJDK, I presume)
> > >
> > > From program running on Redhat:
> > >
> > > 2021-01-07 09:00:42.326  INFO 11442 --- [   main]
> > > o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> > is
> > > starting
> > > 2021-01-07 09:00:42.326 DEBUG 11442 --- [   main]
> > > o.a.c.impl.engine.AbstractCamelContext   : Using
> > > ClassResolver=org.apache.camel.impl.engine.DefaultClassResolver@6d07
> > > a6
&g

Re: EXTERNAL: Re: Can't get routes to Start in SpringBoot / Camel 3.5.0

2021-01-07 Thread Mark Nuttall
Did you try something simple like a direct route? If that does work and the
quartz one doesn't work then it is configured wrong.
If neither do, try ensuring the Component is being created. Put a log
statement in the configure method.
I don't see the package names in your code  but if "beans" are not in
the package or child package of where teh app class is, it wont find it by
default.

Mark

On Thu, Jan 7, 2021 at 10:02 AM Cox, Jeremy  wrote:

> Thank you all for the tips.  These are good improvements, but the route
> still doesn't start.
>
> Adding to application.properties
>
> camel.springboot.main-run-controller = true
>
> prevents the program from shutting down, but the route still does not
> start.
>
>
> I also added quartz dependency.  I verified that jars were added to the
> final jar with the dependency.
>
>
> Sincerely,
>
> Jeremy Cox
> Software Engineer
> Universal Gateway at Progeny Systems
>
> Urgent contact: Text 859.322.3214
> Emailjeremy@progeny.net
>
>
> -Original Message-
> From: Jared Whiklo [mailto:jwhi...@gmail.com]
> Sent: Thursday, January 7, 2021 9:36 AM
> To: users@camel.apache.org
> Subject: EXTERNAL: Re: Can't get routes to Start in SpringBoot / Camel
> 3.5.0
>
> External E-mail --- CAUTION: This email originated from outside Progeny
> Systems. Do not click links or open attachments unless you recognize the
> sender and know the content is safe.
>
> Hey Jeremy,
>
> I just did something similar and while I'm not done I've learned some
> things.
>
> I would guess you need to add the application property defined here to
> keep your routes running.
>
>
> https://camel.apache.org/camel-spring-boot/latest/index.html#_making_sure_camel_context_is_running_in_standalone_spring_boot
>
> Cheers,
> Jared
>
> On Thu., Jan. 7, 2021, 08:09 Cox, Jeremy,  wrote:
>
> > I am trying to port a project from Spring/Camel 2  to Spring Boot /
> > Camel 3.  The routes won't start.  I've tried everything I can think
> > of/ find on google search.
> >
> > 1. I went to start.spring.io and generated a project template.  I
> > commented out the dependencies I am not using yet: jpa, hibernate, etc.
> > 2. I added a test route.
> > 3. I compiled and ran program.
> > 4. My route did not start.
> >
> > I am not sure what is going on.  I have compared to code examples, and
> > everything I have seems correct. I'm hoping I am missing something
> simple.
> > I'm also hoping for a sanity check -- should this be working?
> >
> > I have expanded on this basic start and got my hibernate and SQL
> > databases to connect.  I just can't get the routes to start.
> >
> > I am developing using Redhat 7.6 / OpenJDK 11.  Also deploying Alpine
> > 3.10 with Java 11.  (OpenJDK, I presume)
> >
> > From program running on Redhat:
> >
> > 2021-01-07 09:00:42.326  INFO 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> is
> > starting
> > 2021-01-07 09:00:42.326 DEBUG 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Using
> > ClassResolver=org.apache.camel.impl.engine.DefaultClassResolver@6d07a6
> > 3d,
> > PackageScanClassResolver=org.apache.camel.spring.boot.FatJarPackageSca
> > nClassResolver@571c5681,
> > ApplicationContextClassLoader=org.springframework.boot.loader.Launched
> > URLClassLoader@21b8d17c,
> >
> RouteController=org.apache.camel.impl.engine.DefaultRouteController@488d1cd7
> > 2021-01-07 09:00:42.334  INFO 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : StreamCaching is not in use.
> If
> > using streams then its recommended to enable stream caching. See more
> > details at http://camel.apache.org/stream-caching.html
> > 2021-01-07 09:00:42.334 DEBUG 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Using HeadersMapFactory:
> > org.apache.camel.impl.engine.DefaultHeadersMapFactory@7ceb3185
> > 2021-01-07 09:00:42.334 DEBUG 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Using ReactiveExecutor:
> > org.apache.camel.impl.engine.DefaultReactiveExecutor@436c81a3
> > 2021-01-07 09:00:42.334 DEBUG 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Using ThreadPoolFactory:
> > org.apache.camel.support.DefaultThreadPoolFactory@3561c410
> > 2021-01-07 09:00:42.334  INFO 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Using HealthCheck:
> camel-health
> > 2021-01-07 09:00:42.334 DEBUG 11442 --- [   main]
> > o.a.c.i.e.DefaultStreamCachingStrategy   : StreamCaching is not enabled
> > 2021-01-07 09:00:42.335  INFO 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Total 0 routes, of which 0 are
> > started
> > 2021-01-07 09:00:42.335  INFO 11442 --- [   main]
> > o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> > started in 0.009 seconds
> > 2021-01-07 09:00:42.336 DEBUG 11442 --- [   main]
> > o.a.camel.spring.SpringCamelContext

Re: Maximum version of Spring Boot for Camel 2.25.2?

2020-08-31 Thread Mark Nuttall
go to start.spring.io/info. It will tell you compatible versions.

On Mon, Aug 31, 2020 at 3:42 PM Mikael Andersson Wigander
 wrote:

> I have read somewhere on the site the maximum dependency for Spring Boot
> for Camel 2.x but can't find it.
> What's the recommendation?
>
> We have an app heavily dependent on Camel and need to upgrade Spring Boot
> to 2.2.0.RELEASE due to problems with jUnit5 and 2.1.9.RELEASE using
> vintage jUnit tests in the transition…
>
> Soon to be 3.x…
>
> /M


Re: Enabling global CORS support

2020-08-07 Thread Mark Nuttall
I am pretty sure it is because the annotation is Spring and the other is
Camel and Spring is in control, not Camel. For a global way with spring,
see this -
https://spring.io/guides/gs/rest-service-cors/

On Fri, Aug 7, 2020 at 1:57 AM Ron Cecchini  wrote:

>
> Hi, guys.
>
> I have a Camel (3.4.2) + Spring Boot (2.3.1.RELEASE) web service using
> Undertow.
>
> I ran into my first CORS (cross-origin resource sharing) issue, googled
> around, and solved it with @CrossOrigin.
>
> My question has to do with why I could *not* solve it with
> restConfiguration().enableCORS(true) ?
>
> With or without enableCORS(true), my headers were coming back:
>
> Connection keep-alive
> Content-Type   application/json
> Date   Thu, 06 Aug 2020 22:47:53 GMT
> Transfer-Encoding  chunked
>
> Only when I started using @CrossOrigin with all of my @RestController
> classes did I start getting:
>
> Connection keep-alive
> Content-Type   application/json
> Date   Thu, 06 Aug 2020 22:54:47 GMT
> Transfer-Encoding  chunked
> Vary   Origin, Access-Control-Request-Method,
> Access-Control-Request-Headers
>
> And all of my CORS problems went away.
>
> But I imagine it *must* be possible to do the @CrossOrigin in a global way
> via the restConfiguration().
>
> So what's the magic sauce I'm missing?
>
> Is there something I should be doing with setCorsHeaders() and/or
> corsHeaderProperty()?
> I would think not given the defaults listed at:
> https://camel.apache.org/manual/latest/rest-dsl.html#_default_cors_headers
>
> I'm suspecting some Annotation Sorcery I'm not aware of...
>
> Thanks.
>


Re: Unmarshal Map to POJO with Jackson data format

2020-08-04 Thread Mark Nuttall
you could add an inline processor and specifically call the ObjectMapper
method you need. Or some variant of that. While it is not an OOTB camel
component, it is one less conversion.

On Mon, Aug 3, 2020 at 9:49 PM Jeremy Ross  wrote:

> Hey Sneharghya,
>
> Thanks, that is my workaround. Just hoping for something a little more
> efficient.
>
> On Mon, Aug 3, 2020 at 2:36 PM Sneharghya Pathak 
> wrote:
>
> > Hi Jeremy,
> >
> > The way I fixed it was to first convert it to json and then to a pojo,
> like
> > so:
> >
> > .marshal().json(JsonLibrary.Jackson)
> .unmarshal().json(JsonLibrary.Jackson,
> > MyClass.class)
> >
> > Regards,
> > Sneharghya
> >
> >
> > On Mon, 3 Aug 2020, 10:25 pm Jeremy Ross, 
> wrote:
> >
> > > Howdy,
> > >
> > > Is it possible to unmarshal from a Map to POJO with the Jackson data
> > > format? When I pass it a map, I get:
> > >
> > > org.apache.camel.InvalidPayloadException: No body available of type:
> > > java.io.InputStream but has value...
> > >
> > > ObjectMapper#convertValue supports this, but I'm not sure how to play
> > nice
> > > with the data format. Any tips are appreciated!
> > >
> > > Jeremy
> > >
> >
>


Re: Prometheus metrics for success/failure

2020-07-01 Thread Mark Nuttall
Failures and exceptions should be identified via logs. Camel will log
those. You shouldn't have enough of them to warrant metrics.

Premethius is a metrics system. JMX is just a to access things in the jvm.
Micrometer will do some of what JMX will do. Camel is going to use
micrometer to create the metrics. So just go ahead and use it to publish
the metrics. It is a lot less work than trying to use JMX.

On Wed, Jul 1, 2020, 11:16 AM Stephen Bassett  wrote:

> I would like to monitor Camel routes and track down issues on routes that
> are failing or throwing exceptions.
>
> For folks out there using Camel+Micrometer+Prometheus to gather metrics:
> can you get metrics related to success/failure rates of Camel routes in
> Prometheus? Can you use the metrics to identify problematic routes?
>
> Follow up question: has anyone tried getting Camel metrics via JMX? How
> does that compare with Prometheus?
>
> Thanks
>
> Steve
>


Re: Pause the processing of file

2020-06-12 Thread Mark Nuttall
What that means it will read and send the file line by line to the "to" -
upon successful sending to the "to" it will read and send the next line. It
fails because the direct no longer exists.

On Fri, Jun 12, 2020 at 9:48 AM arshad dar  wrote:

> Thank you for your response
> I was going through the documentation it says
>
> "When in streaming mode, then the splitter splits the original message
> on-demand, and each splitted
> message is processed one by one"
>
> So doesn’t that mean if we don’t have demand it won’t produce new exchanges
>
> if the route that was consuming messages from the first route is suspended.
> does not that mean that there will be no demand now and the first route
> will pause generating exchanges?
>
>
> On Fri, Jun 12, 2020 at 5:15 PM Mark Nuttall  wrote:
>
> > The reason the first does not work is because direct routes are just like
> > one method in a class calling another. And stopping the second is like
> > removing the method.
> >
> > What I do when processing the file is read whole file and write to a
> > topic/queue and then have the second route read from the queue. That way
> > the processing is async and i can stop the second route.
> >
> > I am doing this very thing because my second route calls a third party
> > endpoint and it could be down. If it is down, i stop the processing.
> >
> > On Fri, Jun 12, 2020 at 4:41 AM arshad dar  wrote:
> >
> > > I have two routes below, the first route processing a very large CSV
> file
> > > and the second one converts each record to JSON and forwards the
> message
> > to
> > > http-route
> > >
> > >
> > >
> > > from(fileUri).routeId(mainRouteId).to(dataFormatURI).split(body())
> > >  .streaming()
> > > .to("direct:sample")
> > >
> > > from"direct:sample"
> > >   .marshal().json(JsonLibrary.Jackson)
> > >   .end()
> > >   .to("direct:http-endpoint");
> > >
> > > is there a way I can pause the processing of a file?
> > >
> > > I tried to suspend  the second route but the first route keeps sending
> > > messages and I get ConsumerNotAvailableException
> > >
> > > if I try to suspend the first route, that does not help, it just stops
> > > polling of file component instead of pausing the current file that the
> > > route is processing.
> > >
> > > any help would be appreciated
> > >
> > >
> > >
> > >
> > > --
> > > Arshid
> > >
> >
>
>
> --
> Arshid
>


Re: Pause the processing of file

2020-06-12 Thread Mark Nuttall
The reason the first does not work is because direct routes are just like
one method in a class calling another. And stopping the second is like
removing the method.

What I do when processing the file is read whole file and write to a
topic/queue and then have the second route read from the queue. That way
the processing is async and i can stop the second route.

I am doing this very thing because my second route calls a third party
endpoint and it could be down. If it is down, i stop the processing.

On Fri, Jun 12, 2020 at 4:41 AM arshad dar  wrote:

> I have two routes below, the first route processing a very large CSV file
> and the second one converts each record to JSON and forwards the message to
> http-route
>
>
>
> from(fileUri).routeId(mainRouteId).to(dataFormatURI).split(body())
>  .streaming()
> .to("direct:sample")
>
> from"direct:sample"
>   .marshal().json(JsonLibrary.Jackson)
>   .end()
>   .to("direct:http-endpoint");
>
> is there a way I can pause the processing of a file?
>
> I tried to suspend  the second route but the first route keeps sending
> messages and I get ConsumerNotAvailableException
>
> if I try to suspend the first route, that does not help, it just stops
> polling of file component instead of pausing the current file that the
> route is processing.
>
> any help would be appreciated
>
>
>
>
> --
> Arshid
>


Re: Camel plugin no longer shows up in hawtio

2020-06-04 Thread Mark Nuttall
Might be a version issue. I had the same problem and that is what it was.
Also, debugging is not there unless I drop back camel  versions.

On Thu, Jun 4, 2020, 7:38 PM Jeremy Ross  wrote:

> Hey camel folks,
>
> At some point the Camel plugin stopped showing up in hawtio. I can access
> hawtio just fine, but Camel is not in the menu navigation. I don't recall
> seeing anything in the upgrade guides about it. Did I miss something?
>
> Thanks,
>
> Jeremy
>


Re: reactive java question

2020-05-27 Thread Mark Nuttall
Without seeing the actual code I can't say for sure but I would use
producer template do you send a message to a direct route and have that
direct route to be in the from to start the processing in the route

On Tue, May 26, 2020, 10:31 PM Bing Lu  wrote:

>  I have to incorporate a third party api in order to use the reactive
> functionality of the api. I'm using spring boot with this third party jar,
> and the starting point is the onNext() method that get invoked whenever an
> event occurs. My question is how do I make the onNext() method as a
> starting point of my route, right now I have to build an exchange inside
> the onNext() method and calling methods from there instead of the normal
> from(...).to(...) route building functionality. How do I make the onnext()
> method as a starting point like from(...)?
> thanks


Re: Communicating a value between a route and the RouteBuilder class

2019-12-13 Thread Mark Nuttall
I'm not seeing all the code of course but remember that spring beans by
default are Singletons. So values set at the class level are not thread
safe.

On Fri, Dec 13, 2019, 1:05 AM Ron Cecchini  wrote:

> > On December 12, 2019 at 11:16 AM Claus Ibsen 
> wrote:
> >
> > You can also name your RouteBuilder class with a bean id, if you use
> > spring / spring-boot or cdi etc. And then refer to this bean ids,
> > where you can have methods that you can refer to in the simple bean
> > function.  Then you dont need to add new classes.
>
> Wht...?  You mean my MyRouteBuilder class can have *more* than just
> the single overridden configure() method...!?
>
> *slaps forehead*  Man, talk about not seeing what was right in front of
> me...
>
> So, I am using Spring Boot, and after I took your elegant advice and made
> the AtomicReference a class variable, and created a getter/setter for it, I
> was able to eliminate the process() and setHeader() calls and go from this:
>
> from("timer:mytimer?period={{polling.interval}}")
>  .process(exchange -> exchange.getIn().setHeader("offset",
> offsetCache.get()))
>  .toD("{{url.base}}/${header.offset}")
>  // process the response and get the new offset from the header into
> the class variable
>  .setHeader("offset", simple("${in.header.NEXT_OFFSET}"))
>  .process(exchange ->
> offsetCache.set(exchange.getIn().getHeader("offset").toString()))
>
> to this sweet thing:
>
> from("timer:mytimer?period={{polling.interval}}")
>  .toD("{{url.base}}/${bean:MyRouteBuilder.getOffset}
>  // process the response and get the new offset from the header into
> the class variable
>  .bean("MyRouteBuilder", "setOffset(${in.header.NEXT_OFFSET})")
>
> Thanks as always - and on to the next thing. (figuring out a unified
> logging for routes and classes...)
>


Re: Spring configuring a bean

2019-08-26 Thread Mark Nuttall
if you have the bean defined in XML and also the one in Java, then what is
happening is the Java one is "winning" and say is never set.

On Mon, Aug 26, 2019 at 11:24 AM Ron Cecchini 
wrote:

> I apologize ahead of time, because I feel like I've taken a few steps
> backward and am now hung up on a simple newbie issue regarding application
> properties and Spring configuring beans.
>
> Backstory: I've now created about a dozen Camel projects, all reusing the
> same basic "architecture" I set up a long time ago and the way I imported
> some custom Spring files and properties.
>
> But now I'm having a frustrating newbie problem getting the Spring Boot
> app to see any bean configurations in a "default" Spring or Camel XML file.
>
> I'm sure it's likely a classpath issue or something.  But in case it's
> something more, I willingly embarrass myself and ask you all...
>
> Let's make it real simple:
>
> In IntelliJ, create a new project using the archetype:
> camel-archetype-spring-boot.
>
> You get the file structure:
>
> .
> ├── java
> │   └── org
> │   └── apache
> │   └── camel
> │   └── archetypes
> │   ├── MySpringBean.java
> │   ├── MySpringBootApplication.java
> │   └── MySpringBootRouter.java
> └── resources
> ├── application.properties
> └── META-INF
> ├── LICENSE.txt
> └── NOTICE.txt
>
>
> I now comment out the Spring-injected @Value("${greeting}") in
> MySpringBean and am trying to replace it with a simple camel-context.xml
> where I Spring configure the 'say' class variable containing the "greeting".
>
> -
>
> camel-context.xml:
>
> 
> http://www.springframework.org/schema/beans;
>[...blah blah blah...]
>
> 
> 
> 
>
> 
>
> -
>
> MySpringBean.java:
>
> @Component("myBean")
> public class MySpringBean {
>
> //@Value("${greeting}")
> private String say;
>
> public void setSay(String say) {
> this.say = say;
> }
>
> public String saySomething() {
> System.out.println("*** say = " + say);
> return say;
> }
> }
>
> -
>
> When I run MySpringBootApplication all I get is:
>
> *** say = null
> *** say = null
> *** say = null
> etc
>
> FWIW, I tried naming the file both "camel-context.xml" and
> "camelContext.xml" as well as putting the files under "resources" and
> "resources/spring".  But none of those 4 configurations works.
>
> Thanks for any help.
>
> (I am now positioning my palm directly in front of my space so I can smack
> myself once my simple error is pointed out.)
>
> Ron
>


Re: Camel + Spring Boot as a backend?

2019-04-16 Thread Mark Nuttall
I use Spring Boot extensively with Camel.
It is a perfect pair for what you are asking about.
I have i running locally on servers and also in aws in EC2.  Works great
both ways.

Start by going to start.spring.io and pick Camel and JDBC (or JPA,etc), or
if you have IntelliJ or STS you can just use those to create a spring boot
app.
You will want to add "web" and actuator so you can monitor the health of
you app.



On Tue, Apr 16, 2019 at 11:34 AM Luiz Eduardo Valmont <
valm...@alis-sol.com.br> wrote:

> I use Spring Boot, Camel and Quartz on a symbiotic-ish application. There's
> REST endpoints as well.
>
> On Tue, 16 Apr 2019, 11:54 Michael Joyner, 
> wrote:
>
> > I assume using Spring MVC for the front end. I think that you would be
> > fine. Someone else will probably chime in from the project and confirm.
> >
> > On Tue, Apr 16, 2019 at 7:29 AM Ron Cecchini 
> > wrote:
> >
> > > Hi, all.  If/when anyone has any time, I was hoping to get a few quick
> > > opinions.
> > > (and I do mean be brief; I don't want anyone wasting time on this.)
> > >
> > > *** Could Camel + Spring Boot *alone* be used to implement the Java
> > > portion of
> > > *** a simple backend for a low-throughput, non-realtime system that
> > > doesn't need to scale?
> > >
> > > Backstory: I was thinking about the web site for my sons' little league
> > (I
> > > didn't create it),
> > > and what I might do if I were to redo it totally from scratch without
> > > using Wordpress, etc.
> > >
> > > This quickly morphed (away from baseball and) into what it would take
> to
> > > implement what
> > > basically amounts to a simple inventory tracking system of sorts.
> > >
> > > And the picture I had in mind is something like.  Imagine you are an
> > > online business with:
> > >
> > > - 100 customers or offices  (whatever - call them "sites")
> > >
> > > - Each "site" is going to place at most, on average, 1 order a day
> > >   where an "order" might be to ship goods to another site, request
> goods
> > > from another site,
> > >   or order goods from a vendor  (whatever - the details of the "order"
> > > don't matter)
> > >
> > > - Each site now needs to be able to track the progress of its order
> > (where
> > > its good are)
> > >
> > > Basically, something like a poor man's Amazon or USPS/UPS/FedEx
> tracking
> > > system.
> > >
> > > Again, the system doesn't need to scale because there will never be
> more
> > > than 100-200 sites.
> > > Sites will spend the majority of their time inactive; i.e. not placing
> > > orders.
> > > Each order is a simple movement of goods (shipping or
> > procuring/receiving).
> > > There are no real time demands to know exactly where goods are.  (A
> daily
> > > update would suffice.)
> > >
> > > Since the concurrency needs seem to be negligible, I don't see a need
> for
> > > a JBoss app server,
> > > or a distributed server farm, etc.  I feel like Camel will already
> handle
> > > whatever concurrency
> > > issues that may arise, and its ability to seamlessly integrate with so
> > > many others means alot of
> > > the work is already done for me.
> > >
> > > What are your thoughts on trying to implement the backend of this
> simple
> > > inventory system with
> > > a pretty simple Spring Boot + Camel + RDMS application, hosted on a
> beefy
> > > server and not running
> > > in an app server or Docker?
> > >
> > > Thanks.
> > >
> > > Ron
> > >
> >
> >
> > --
> > Sincerely,
> > Michael Joyner
> >
>


Re: Java DSL route now needs a MS SQL .to( How do I declare connection info?

2018-07-30 Thread Mark Nuttall
It just makes it so easy especially with spring boot. I've never tried it
without Spring. I only do the Java DSL.

To do it in Spring (Boot)

Go here - https://start.spring.io/
Pick Web, Camel, and SQL Server
create the zip and import to your favorite IDE. (if you are using IntelliJ
then you should have support for making it easy to run Spring Boot apps.
Otherwise, use STS or netbeans plus the Spring plugin.)
add the camel-jdbc dependency to your pom
create a route as per the Java DSL and JDBC component instructions
add the sql server connection to the applications.properties like this
1
2
3
4
5
6
7
spring.datasource.url=jdbc:sqlserver://localhost;databaseName=springbootdb
spring.datasource.username=sa
spring.datasource.password=Projects@123
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.
SQLServerDriver

spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect



run app as spring boot app


On Mon, Jul 30, 2018 at 2:08 PM, John F. Berry 
wrote:

>  I desire NOT to incorporate Spring with the mix I have.  I will if that
> is the standard way, but not sure how you would do that.
>
> On Monday, July 30, 2018, 12:29:20 PM EDT, Mark Nuttall <
> mknutt...@gmail.com> wrote:
>
>  Are you using Spring with the Java DSL? Just not sure if you are / aren't.
>
> On Mon, Jul 30, 2018 at 11:45 AM, John F. Berry
>  > wrote:
>
> > Thanks Quinn for the helping hand.
> >
> > I've been looking for examples of how to declare the servername/instance
> > name, username password to utilize a MS SQL endpoint.  Looking at the
> > Apache Camel: SQL Component page, it shows utilizing  the declared object
> > like "mydbconnection" that is the named DataSource option, and shows all
> on
> > what you can throw through that connection... except seems to skip over
> how
> > to specify connection criteria.  It does reference the DataSource option
> as
> > a pointer to look up in the "registry" but I don't know if that is an
> > inherited existing entity it's talking about or the need to declare a new
> > registry and import a form of camel registry or something.  The only
> > examples where I've seen servername, un/pw declared in an example was in
> a
> > Spring one.  I don't know if we want to "un-translate" a Spring example,
> > but point me in the direction of where I should natively set these things
> > in Java DSL.  The above mentioned page even says "This component uses
> > spring-jdbc behind the scenes for the actual SQL handling", so I figured
> > that is why I cannot seem to get away from Spring.
> > When I look at the Apache Camel: SQL Example(
> http://camel.apache.org/sql-
> > example.html )  page, it talks about "In the camel-context.xml file in
> > the src/main/resources/META-INF/spring folder we have the Spring XML
> file
> > to setup and configure the database"
> >
> > I see connection parameters set like in this other example:
> >
> >  > destroy-method="close">
> > < property  name = "driverClassName"  value = "org.apache.derby.jdbc.
> EmbeddedDriver"
> > />
> >
> > < property  name = "url"  value = "jdbc:derby:memory:orders;create=true"
> > />
> >
> > < property  name = "username"  value = "" />
> >
> > < property  name = "password"  value = "" />
> >
> > 
> >
> >
> > but not declared in the Java DSL, if that's even possible.. Perhaps
> > .setheaders() ?  but then.. what are the paramater names?
> >
> >
> > Sorry.. I know it's a bit of a "thrashing" response...
> >
> >
> >
> > On Monday, July 30, 2018, 10:43:34 AM EDT, Quinn Stevenson <
> > qu...@pronoia-solutions.com> wrote:
> >
> >
> >
> >
> >
> > From my experience, I’ve always been able to to more with the Java DSL
> > than with Spring.  I think routes written using the Spring XML are easier
> > to read than routes written the Java DSL, but that’s just me.
> >
> > If you could post you’re Spring XML that you’re trying to translate, I’m
> > sure we can help with that.
> >
> > > On Jul 30, 2018, at 8:00 AM, John F. Berry  >
> > wrote:
> > >
> > > I've been perusing ways to declare connection to a MS SQL server.
> There
> > are plenty of Spring examples.. but how about Java DSL?  I have been
> > attempting to utilizing the JDBC endpoint provided though camel-sql..
> but I
> > cannot seem to either find documentation of how to place a configuration
> > file with an unknown

Re: Java DSL route now needs a MS SQL .to( How do I declare connection info?

2018-07-30 Thread Mark Nuttall
Are you using Spring with the Java DSL? Just not sure if you are / aren't.

On Mon, Jul 30, 2018 at 11:45 AM, John F. Berry  wrote:

> Thanks Quinn for the helping hand.
>
> I've been looking for examples of how to declare the servername/instance
> name, username password to utilize a MS SQL endpoint.  Looking at the
> Apache Camel: SQL Component page, it shows utilizing  the declared object
> like "mydbconnection" that is the named DataSource option, and shows all on
> what you can throw through that connection... except seems to skip over how
> to specify connection criteria.  It does reference the DataSource option as
> a pointer to look up in the "registry" but I don't know if that is an
> inherited existing entity it's talking about or the need to declare a new
> registry and import a form of camel registry or something.  The only
> examples where I've seen servername, un/pw declared in an example was in a
> Spring one.  I don't know if we want to "un-translate" a Spring example,
> but point me in the direction of where I should natively set these things
> in Java DSL.  The above mentioned page even says "This component uses
> spring-jdbc behind the scenes for the actual SQL handling", so I figured
> that is why I cannot seem to get away from Spring.
> When I look at the Apache Camel: SQL Example( http://camel.apache.org/sql-
> example.html )  page, it talks about "In the camel-context.xml file in
> the src/main/resources/META-INF/spring folder we have the Spring XML file
> to setup and configure the database"
>
> I see connection parameters set like in this other example:
>
>  destroy-method="close">
> < property   name = "driverClassName"   value = 
> "org.apache.derby.jdbc.EmbeddedDriver"
> />
>
> < property   name = "url"   value = "jdbc:derby:memory:orders;create=true"
> />
>
> < property   name = "username"   value = "" />
>
> < property   name = "password"   value = "" />
>
> 
>
>
> but not declared in the Java DSL, if that's even possible.. Perhaps
> .setheaders() ?  but then.. what are the paramater names?
>
>
> Sorry.. I know it's a bit of a "thrashing" response...
>
>
>
> On Monday, July 30, 2018, 10:43:34 AM EDT, Quinn Stevenson <
> qu...@pronoia-solutions.com> wrote:
>
>
>
>
>
> From my experience, I’ve always been able to to more with the Java DSL
> than with Spring.  I think routes written using the Spring XML are easier
> to read than routes written the Java DSL, but that’s just me.
>
> If you could post you’re Spring XML that you’re trying to translate, I’m
> sure we can help with that.
>
> > On Jul 30, 2018, at 8:00 AM, John F. Berry 
> wrote:
> >
> > I've been perusing ways to declare connection to a MS SQL server.  There
> are plenty of Spring examples.. but how about Java DSL?  I have been
> attempting to utilizing the JDBC endpoint provided though camel-sql.. but I
> cannot seem to either find documentation of how to place a configuration
> file with an unknown name in an unknown location in the project, or declare
> it in-line.  Been looking at setting it first in the "camel registry", but
> no luck so far.
> > I did not include any code, since I have nothing functional or "in
> progress" to show for my efforts.  I'm not to the point I need to form any
> sort of SQL statement yet, since I cannot establish a connection.It seems
> so simple, but I cannot find how to simply declare server:port, un/pw
> without bringing a Spring context into the mix.  If that is needed to
> satisfy the camel vanilla SQL endpoint needs, how do I tie that into the
> Java DSL route I've already got going?  I went the Java DSL route simply
> because some other endpoints didn't have a straight forward Camel Spring
> solution to them.  Is this mixed environment normal?  Is there really not a
> choice to keep a route "clean" in one coding style or the other?
> > Thanks!
>


Re: Spring boot gives null pointer in xml based camel configutaions

2018-06-27 Thread Mark Nuttall
Can you switch to Java routes instead XML? I am deploying Spring Boot Camel
Java routes as war's with no issues.

On Wed, Jun 27, 2018 at 2:09 PM, David Karlsen 
wrote:

> No - it is not wrong to create .war's:
> https://docs.spring.io/spring-boot/docs/1.5.14.RELEASE/
> reference/htmlsingle/#howto-create-a-deployable-war-file
> - but not the most common deployment model.
>
> Anyway - we're drifting away from the original problem which is the NPE in
> the CamelBeanPostProcessor.postProcessBeforeInitialization(
> CamelBeanPostProcessor.java:159).
>
> There seems to be others that have the very same problem:
> https://medium.freecodecamp.org/configure-multiple-camel-
> context-in-spring-boot-application-d3a16396266
>
> From http://camel.apache.org/spring-boot.html,  "Adding XML Routes",
> there
> seems to possible to load xml-based routes from a common place - but these
> are *routes* not contexts.
> This is a vanilla spring+camel app which is being migrated to boot+camel
>
> Is it safe to say that multiple *Camel Contexts* is not supported when
> using boot? Is it by design or should an issue be opened?
> The way to migrate this is maybe to try to remove the camel context parts,
> and be left with the xml-based routes and follow the pattern in "Adding XML
> routes" as described above?
>
>
> Den ons. 27. jun. 2018 kl. 17:18 skrev Doug Douglass <
> douglass.d...@gmail.com>:
>
> > On Wed, Jun 27, 2018 at 12:18 AM Claus Ibsen 
> > wrote:
> >
> > > Hi
> > >
> > > Its a bit confusing what you do. Are you really packaging spring-boot
> > > inside a WAR file and then deploying that to Jetty?
> > > If so this is wrong. Spring Boot is a standalone runtime which you
> > > should not embed in others.
> > >
> >
> > While perhaps not directly related to the users NPE problem...
> >
> > It is not "wrong" to package a Spring Boot-based app as a WAR and deploy
> to
> > a container, though it certainly isn't the usual way.
> >
> > On a recent project (ended last year) using Spring Boot 1.5.4.RELEASE and
> > Camel 2.19.1, the deployment environment dictated WARs deployed to Tomcat
> > servers. This required changing the packaging in the POM to war, setting
> > the spring-boot-starter-tomcat dependency to provided so as not to
> include
> > conflicting tomcat classes in the WARs, and modifying the application
> > classes as follows:
> >
> > @SpringBootApplication
> > public class MyApplication
> > extends SpringBootServletInitializer {
> > public static void main(String[] args) {
> > ApplicationContext applicationContext = new SpringApplication(
> MyApplication
> > .class).run(args);
> > CamelSpringBootApplicationController applicationController =
> > applicationContext.getBean(CamelSpringBootApplicationController.class);
> > applicationController.run();
> > }
> >
> > @Override
> > protected SpringApplicationBuilder
> > configure(SpringApplicationBuilder builder) {
> >builder.sources(MyApplication.class);
> >return builder;
> > }
> >
> > ...
> > }
> >
> > The main method allows running the application from Eclipse/STS or the
> > spring-boot maven plugin. Extending SpringBootServletInitializer and
> > overriding configure() allows the app to initialize correctly when
> deployed
> > to a container. Note that all the applications used Java config for both
> > Spring and Camel routes.
> >
> > YMMV if using Spring Boot 2
> >
> >
> > >
> > > On Sun, Jun 24, 2018 at 9:44 PM, Mohit Sharma 
> > > wrote:
> > > >
> > > > Hi All,
> > > >
> > > > My name is Mohit and I am working with EVRY AS Norway<
> > > https://www.evry.com/> .
> > > >
> > > > I am trying to upgraded existing Spring application based web
> > > application running on jetty to Spring boot. I have updated
> dependencies
> > > (respective pom's).
> > > >
> > > > Now when I am running jetty, it give error for camel related
> > > configuration, ex of camel configuration which is working on spring
> > > >
> > > > Context file with camel configurations :
> > > >
> > > > 
> > > > http://www.springframework.org/schema/beans;
> > > >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
> > > xmlns:util="http://www.springframework.org/schema/util;
> > > >xmlns:context="http://www.springframework.org/schema/context;
> > > >xmlns:camel="http://camel.apache.org/schema/spring;
> > > >xsi:schemaLocation="http://www.springframework.org/
> schema/beans
> > > http://www.springframework.org/schema/beans/spring-beans.xsd
> > > >
> > http://www.springframework.org/schema/util
> > > http://www.springframework.org/schema/util/spring-util.xsd
> > > >   http://camel.apache.org/schema/spring
> > > http://camel.apache.org/schema/spring/camel-spring.xsd
> > > >
> > > http://www.springframework.org/schema/context
> > > http://www.springframework.org/schema/context/spring-context.xsd;>
> > > >
> > > >  > >
> > class="com.edb.payment.pays.core.pwh.service.notification.
> 

Re: Cannot send files bigger then 256kb to service bus via amqps

2018-06-22 Thread Mark Nuttall
the following link on stackoverflow seems to indicate it is an Azure
service bus limitation

https://stackoverflow.com/questions/22384193/azure-service-bus-message-size-technology-limit-and-pricing

On Fri, Jun 22, 2018 at 10:09 AM, Tunikov, Eugeniy 
wrote:

> I am new to camel framework so I cannot go deeper into the problem.
> Basicly what we are doing is sending messages to azure service bus queue
> and getting error when messages are bigger then 256kb.
> The owner of service bus suggested that I should change configuration to
> something like this
>
>  maxBufferSize="2147483647"
> maxBufferPoolSize="2147483647"
>  maxReceivedMessageSize="2147483647">
>
> and since my project is in java and not .net i need to be able to change
> these values somewhere.
>
> I also did some debugging of camel and I notice a property
> public void setMaxMessageSize(UnsignedLong maxMessageSize)
>  in
>  org.apache.qpid.amqp_1_0.type.transport.Attach class
> which is always being set to 262144.
> I don't know where the value is coming from but my guess is that whats
> causing the problem.
>
> I hope its more clear now.
>
> Thanks
>
>
> -Original Message-
> From: Quinn Stevenson 
> Sent: 22. juni 2018 15:14
> To: users@camel.apache.org
> Subject: Re: Cannot send files bigger then 256kb to service bus via amqps
>
>
>
> Can you be more specific about what is failing where?
>
> We process over 100,000 multi-megabyte messages per day and have never hit
> this sort of an issue.
>
>
>
> > On Jun 22, 2018, at 1:20 AM, Tunikov, Eugeniy 
> wrote:
> >
> > We are routing messages to service bus. And getting error when trying to
> send messages bigger then 256kb.
> > Error{condition=message-size-exceeded,description=The received message
> > (delivery-id:0, size:327565 bytes) exceeds the limit (262144 bytes)
> currently allowed on the link.} And also exception saying that link has
> been detached.
> > Is this message soming from service bus or from camel framework? And how
> can I solve it?
> >
> > Thanks
> >
>
>


Re: Need some very lite help

2018-05-11 Thread Mark Nuttall
My suggestion is to use camel with spring boot.  They are a fantastic
combo. And make getting up and running easy.

On Fri, May 11, 2018, 5:55 PM Michael Joyner 
wrote:

> Hi all! I am moving from Mulesoft to Camel. I was wondering if there was
> anyone that could help professionally with TalendESB/Camel/Karaf for
> VERY LITE assistance in creating Proof-Of-Concepts. I am coming up to
> speed on Camel, but it would be great to have someone to email if I get
> stuck or need guidance. Willing to Pay.
>
>


Re: Recommendation/Best Practice for shutting down Camel Spring Boot App

2018-04-04 Thread Mark Nuttall
even though your app is not a web app, adding "web" and actuator add value
for things like metrics and health status  and things like this. Why
not just add those two items? That is what i do.

And fyi,  you might ask this on the spring forums as this really is a
Spring Boot question.

On Wed, Apr 4, 2018 at 4:20 PM, Jonathan Cook 
wrote:

> Hello,
>
> I was wondering if there was a way to shutdown a camel application which
> uses Spring Boot in a graceful way? I've seen this page -
> http://camel.apache.org/graceful-shutdown.html but it doesn't really
> explain it. For example I have a shell script for starting the app which
> runs my standalone java app.
>
> To shut it down I was thinking of another shell script but don't simply
> want to kill the process. I've see Spring Boot Actuator provides a way via
> http but my app is not a webapp in a fat jar, just a standalone java app.
> I've also seen Spring Boot has a ApplicationPidFileWriter which writes the
> pid to a file but again this approach uses a brute force kill.
>
> There seems to be a couple of tests here related to it:
> https://github.com/apache/camel/tree/master/components/camel
> -spring-boot/src/test/java/org/apache/camel/spring/boot
>
> But it isn't clear, do I have to create some kind of custom shutdown hook
> which I can call externally and stop the camel context or shut the routes
> down gracefully or does something in Camel Spring Boot do this for me?
>
> Thanks for any help
>


Re: Enabling message tracing using Jolokia

2018-04-02 Thread Mark Nuttall
this seems like a hawtio question.

Maybe try this. I only just saw it so i have not tried it.
https://github.com/hawtio/hawtio/tree/master/hawtio-sample-springboot



On Mon, Apr 2, 2018 at 3:37 PM, Reji Mathews  wrote:

> Hi guys
>
> I am currently deploying camel routes as springboot apps. Is there a way I
> can enable the hawtio UI into it ?
>
> My requirement is to have a monitoring feature enabled over the route level
> jmx metrics
>


Re: Spring Boot 2

2018-03-02 Thread Mark Nuttall
I will help test. I have quite a few things using Spring Boot and Camel and
would like to update as soon as i can :)

On Fri, Mar 2, 2018 at 10:01 AM, Claus Ibsen  wrote:

> Hi
>
> Well when 2.21 is out the door and its 2.21.x branch is setup, then we
> would likely fairly quickly get the master branch update to SB2 /
> Spring 5 and hit the issues there and then you guys can help test the
> stuff with the SNAPSHOT builds of Camel.
>
> They are published to the ASF Maven snapshot repo
> https://www.apache.org/dev/repository-faq.html#repodotapache
>
> On Fri, Mar 2, 2018 at 3:44 PM, James Green 
> wrote:
> > Bah, 2.22, YKWIM!
> >
> > On 2 March 2018 at 14:43, James Green  wrote:
> >
> >> Thanks for the quick replies - we'll hold fire for 2.21.
> >>
> >> On 2 March 2018 at 14:33, Andrea Cosentino 
> wrote:
> >>
> >>> Actually there is a branch boot2 in apache camel repo, based on
> >>> camel-2.21.0-SNAPSHOT, with some work about Spring Boot 2.
> >>>
> >>> The target release for fully support Spring Boot 2 is 2.22.0
> >>>
> >>> --
> >>> Andrea Cosentino
> >>> --
> >>> Apache Camel PMC Member
> >>> Apache Karaf Committer
> >>> Apache Servicemix PMC Member
> >>> Email: ancosen1...@yahoo.com
> >>> Twitter: @oscerd2
> >>> Github: oscerd
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On Friday, March 2, 2018, 3:30:50 PM GMT+1, James Green <
> >>> james.mk.gr...@gmail.com> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> I'm guessing that the current Camel release just won't do...
> >>>
> >>> Caused by: java.lang.NoClassDefFoundError:
> >>> org/springframework/boot/bind/RelaxedPropertyResolver
> >>> at
> >>> org.apache.camel.spring.boot.security.CamelSSLAutoConfigurat
> >>> ion$Condition.getMatchOutcome(CamelSSLAutoConfiguration.java:51)
> >>> at
> >>> org.springframework.boot.autoconfigure.condition.SpringBootC
> >>> ondition.matches(SpringBootCondition.java:47)
> >>> ... 41 more
> >>> Caused by: java.lang.ClassNotFoundException:
> >>> org.springframework.boot.bind.RelaxedPropertyResolver
> >>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> >>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> >>> ... 43 more
> >>>
> >>> I noted a line in the 2.20 release notes talking about upcoming
> >>> compatibility. Would I be right to abandon this upgrade in my project
> >>> until
> >>> the next minor release of Camel?
> >>>
> >>> Thanks,
> >>>
> >>> James
> >>>
> >>
> >>
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Apache Camel vs Apache Storm

2018-02-15 Thread Mark Nuttall
What is it that you are trying to do? There is a plethora of projects on
Apache.org. Some do sort of the same thing. Some do some of the same
things. Some don't.

On Thu, Feb 15, 2018 at 4:30 PM, Guillermo Castro 
wrote:

> Apache Storm is a distributed real-time computation system whose main
> purpose is the real-time processing of data, and from what I know, is
> limited to connecting queueing systems and databases.
>
> Apache Camel is an Enterprise Integration Pattern system which allows
> you to connect, route and process data from a vast array of current
> and legacy systems.
>
> You can integrate both systems to cover different needs in your
> project (e.g. data processing using Storm, REST interfaces using
> camel, etc).
>
> Hope that helps.
>
> On Thu, Feb 15, 2018 at 3:00 PM, Pavel Sapozhnikov
>  wrote:
> > Hello
> >
> > I am new to Camel but I have some brief knowledge of Storm and how that
> > works. We're trying to investigate both libraries for the project that
> > we're about to do and we're deciding between Camel and Storm. What are
> some
> > of the key decision factors that we should be focused on when it comes to
> > both applications.
> >
> > Our project needs to subscribe to JMS, archive messages, transform
> messages
> > in some cases from one format to another and save into database.
> >
> > We have a prototype of Storm doing this but how can Camel do this better?
> > Are the two libraries used for different purposes?
> >
> > Thanks
> > Pavel
>
>
>
> --
> Guillermo Castro
> webmas...@javageek.org   http://javageek.org/
>


Re: Problem with upgrade from camel 2.19.3 to camel 2.20.0

2017-10-24 Thread Mark Nuttall
I don't know enough about the inner workings of Camel to tell you about the
version issue.
If i remember rightly, I've heard of or experience the same sort of thing
when doing outside the box things, like this. It is really a timing issue,
if i remember rightly.



On Tue, Oct 24, 2017 at 1:18 PM, Dicken George <dickengeo...@gmail.com>
wrote:

> so in the stack trace it talks about line 66 but when i debug i can see
> that
>
>"camelContext.startRoute("salesforce-versions");"
>
> already in line 64 meaning the route is not started as the routeservices
> object is empty (null).  Which thereby causes and expection at line 66
> which is
>
>Endpoint ep = theRoute.getEndpoint();
>
> I am wondering if there any specific call which adds all routes to the
> camelcontext differently in 2.19.x compared to 2.20.0 ?
>
>
>
> On Tue, Oct 24, 2017 at 7:13 PM, Mark Nuttall <mknutt...@gmail.com> wrote:
>
> > Oh. i missed the "complex use case". Of the code you provided, what is
> line
> > 66?
> >
> > On Tue, Oct 24, 2017 at 11:47 AM, Mark Nuttall <mknutt...@gmail.com>
> > wrote:
> >
> > > Is there any reason you are not using the standard Spring Boot + Camel
> > > mechanisms to create the context and routes. I don't readily see any in
> > > your code.  Doing so might resolve the problem.  Let me know if you
> need
> > > help with that..
> > >
> > > Mark
> > >
> > > On Tue, Oct 24, 2017 at 9:36 AM, Dicken George <dickengeo...@gmail.com
> >
> > > wrote:
> > >
> > >> Dear Fellow Developers,
> > >>
> > >> Just recently, I tried to upgrade my camel-spring boot project form
> > camel
> > >> 2.19.3 to camel 2.20.0 and I face the problem that, I cannot boot up
> my
> > >> application any more, and I get the following stack trace
> > >>
> > >> java.lang.NullPointerException
> > >> at
> > >> com.haufe.ssmp.sfdc.api.app.BeanConfiguration.afterApplicati
> > >> onStart(BeanConfiguration.java:66)
> > >> at
> > >> org.apache.camel.spring.boot.RoutesCollector.onApplicationEv
> > >> ent(RoutesCollector.java:226)
> > >> at
> > >> org.apache.camel.spring.boot.RoutesCollector.onApplicationEv
> > >> ent(RoutesCollector.java:54)
> > >> at
> > >> org.springframework.context.event.SimpleApplicationEventMult
> > >> icaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
> > >> at
> > >> org.springframework.context.event.SimpleApplicationEventMult
> > >> icaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
> > >> at
> > >> org.springframework.context.event.SimpleApplicationEventMult
> > >> icaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
> > >> at
> > >> org.springframework.context.support.AbstractApplicationConte
> > >> xt.publishEvent(AbstractApplicationContext.java:393)
> > >> at
> > >> org.springframework.context.support.AbstractApplicationConte
> > >> xt.publishEvent(AbstractApplicationContext.java:347)
> > >> at
> > >> org.springframework.context.support.AbstractApplicationConte
> > >> xt.finishRefresh(AbstractApplicationContext.java:883)
> > >> at
> > >> org.springframework.boot.context.embedded.EmbeddedWebApplica
> > >> tionContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
> > >> at
> > >> org.springframework.context.support.AbstractApplicationConte
> > >> xt.refresh(AbstractApplicationContext.java:546)
> > >> at
> > >> org.springframework.boot.context.embedded.EmbeddedWebApplica
> > >> tionContext.refresh(EmbeddedWebApplicationContext.java:122)
> > >> at
> > >> org.springframework.boot.SpringApplication.refresh(SpringApp
> > >> lication.java:693)
> > >> at
> > >> org.springframework.boot.SpringApplication.refreshContext(Sp
> > >> ringApplication.java:360)
> > >> at
> > >> org.springframework.boot.SpringApplication.run(SpringApplica
> > >> tion.java:303)
> > >> at
> > >> org.springframework.boot.SpringApplication.run(SpringApplica
> > >> tion.java:1118)
> > >> at
> > >> org.springframework.boot.SpringApplication.run(SpringApplica
> > >> tion.java:1107)
> > >> at com.haufe.ssmp.sfdc.api.Applicatio

Re: Problem with upgrade from camel 2.19.3 to camel 2.20.0

2017-10-24 Thread Mark Nuttall
Oh. i missed the "complex use case". Of the code you provided, what is line
66?

On Tue, Oct 24, 2017 at 11:47 AM, Mark Nuttall <mknutt...@gmail.com> wrote:

> Is there any reason you are not using the standard Spring Boot + Camel
> mechanisms to create the context and routes. I don't readily see any in
> your code.  Doing so might resolve the problem.  Let me know if you need
> help with that..
>
> Mark
>
> On Tue, Oct 24, 2017 at 9:36 AM, Dicken George <dickengeo...@gmail.com>
> wrote:
>
>> Dear Fellow Developers,
>>
>> Just recently, I tried to upgrade my camel-spring boot project form camel
>> 2.19.3 to camel 2.20.0 and I face the problem that, I cannot boot up my
>> application any more, and I get the following stack trace
>>
>> java.lang.NullPointerException
>> at
>> com.haufe.ssmp.sfdc.api.app.BeanConfiguration.afterApplicati
>> onStart(BeanConfiguration.java:66)
>> at
>> org.apache.camel.spring.boot.RoutesCollector.onApplicationEv
>> ent(RoutesCollector.java:226)
>> at
>> org.apache.camel.spring.boot.RoutesCollector.onApplicationEv
>> ent(RoutesCollector.java:54)
>> at
>> org.springframework.context.event.SimpleApplicationEventMult
>> icaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
>> at
>> org.springframework.context.event.SimpleApplicationEventMult
>> icaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
>> at
>> org.springframework.context.event.SimpleApplicationEventMult
>> icaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
>> at
>> org.springframework.context.support.AbstractApplicationConte
>> xt.publishEvent(AbstractApplicationContext.java:393)
>> at
>> org.springframework.context.support.AbstractApplicationConte
>> xt.publishEvent(AbstractApplicationContext.java:347)
>> at
>> org.springframework.context.support.AbstractApplicationConte
>> xt.finishRefresh(AbstractApplicationContext.java:883)
>> at
>> org.springframework.boot.context.embedded.EmbeddedWebApplica
>> tionContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
>> at
>> org.springframework.context.support.AbstractApplicationConte
>> xt.refresh(AbstractApplicationContext.java:546)
>> at
>> org.springframework.boot.context.embedded.EmbeddedWebApplica
>> tionContext.refresh(EmbeddedWebApplicationContext.java:122)
>> at
>> org.springframework.boot.SpringApplication.refresh(SpringApp
>> lication.java:693)
>> at
>> org.springframework.boot.SpringApplication.refreshContext(Sp
>> ringApplication.java:360)
>> at
>> org.springframework.boot.SpringApplication.run(SpringApplica
>> tion.java:303)
>> at
>> org.springframework.boot.SpringApplication.run(SpringApplica
>> tion.java:1118)
>> at
>> org.springframework.boot.SpringApplication.run(SpringApplica
>> tion.java:1107)
>> at com.haufe.ssmp.sfdc.api.Application.main(Application.java:12)
>>
>> Due to my complex use case, i would like to start one specific route
>> manually and not use the autoconfiguration and autostart from
>> camelcontext.
>> I do this in my configuration class by over riding the before application
>> start and after application start methods.
>>
>> @Configuration
>> class BeanConfiguration implements CamelContextConfiguration {
>> private static final Logger log =
>> LoggerFactory.getLogger(BeanConfiguration.class);
>>
>> @Override
>> public void beforeApplicationStart(CamelContext camelContext) {
>> camelContext.setPackageScanClassResolver(new
>> FatJarPackageScanClassResolver());
>> camelContext.resolveDataFormat("json-jackson");
>> }
>>
>> @Autowired
>> SalesforceComponent sfdcComp;
>>
>> @Override
>> public void afterApplicationStart(CamelContext camelContext) {
>>
>> try {
>> sfdcComp.start();
>> camelContext.startRoute("salesforce-versions");
>> Route theRoute = camelContext.getRoute("salesfo
>> rce-versions");
>> Endpoint ep = theRoute.getEndpoint();
>>
>> Exchange exchange = ep.createExchange();
>> ProducerTemplate template =
>> exchange.getContext().createProducerTemplate();
>> DefaultExchange o = (DefaultExchange) template.request(ep, new
>> Processor() {
>>
>> @Override
>> public void process(Exchange exchange) throws Exception {
>>

Re: Problem with upgrade from camel 2.19.3 to camel 2.20.0

2017-10-24 Thread Mark Nuttall
Is there any reason you are not using the standard Spring Boot + Camel
mechanisms to create the context and routes. I don't readily see any in
your code.  Doing so might resolve the problem.  Let me know if you need
help with that..

Mark

On Tue, Oct 24, 2017 at 9:36 AM, Dicken George 
wrote:

> Dear Fellow Developers,
>
> Just recently, I tried to upgrade my camel-spring boot project form camel
> 2.19.3 to camel 2.20.0 and I face the problem that, I cannot boot up my
> application any more, and I get the following stack trace
>
> java.lang.NullPointerException
> at
> com.haufe.ssmp.sfdc.api.app.BeanConfiguration.afterApplicationStart(
> BeanConfiguration.java:66)
> at
> org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(
> RoutesCollector.java:226)
> at
> org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(
> RoutesCollector.java:54)
> at
> org.springframework.context.event.SimpleApplicationEventMulticas
> ter.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
> at
> org.springframework.context.event.SimpleApplicationEventMulticas
> ter.invokeListener(SimpleApplicationEventMulticaster.java:165)
> at
> org.springframework.context.event.SimpleApplicationEventMulticas
> ter.multicastEvent(SimpleApplicationEventMulticaster.java:139)
> at
> org.springframework.context.support.AbstractApplicationContext.
> publishEvent(AbstractApplicationContext.java:393)
> at
> org.springframework.context.support.AbstractApplicationContext.
> publishEvent(AbstractApplicationContext.java:347)
> at
> org.springframework.context.support.AbstractApplicationContext.
> finishRefresh(AbstractApplicationContext.java:883)
> at
> org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.
> finishRefresh(EmbeddedWebApplicationContext.java:144)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(
> AbstractApplicationContext.java:546)
> at
> org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.
> refresh(EmbeddedWebApplicationContext.java:122)
> at
> org.springframework.boot.SpringApplication.refresh(
> SpringApplication.java:693)
> at
> org.springframework.boot.SpringApplication.refreshContext(
> SpringApplication.java:360)
> at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
> at
> org.springframework.boot.SpringApplication.run(
> SpringApplication.java:1118)
> at
> org.springframework.boot.SpringApplication.run(
> SpringApplication.java:1107)
> at com.haufe.ssmp.sfdc.api.Application.main(Application.java:12)
>
> Due to my complex use case, i would like to start one specific route
> manually and not use the autoconfiguration and autostart from camelcontext.
> I do this in my configuration class by over riding the before application
> start and after application start methods.
>
> @Configuration
> class BeanConfiguration implements CamelContextConfiguration {
> private static final Logger log =
> LoggerFactory.getLogger(BeanConfiguration.class);
>
> @Override
> public void beforeApplicationStart(CamelContext camelContext) {
> camelContext.setPackageScanClassResolver(new
> FatJarPackageScanClassResolver());
> camelContext.resolveDataFormat("json-jackson");
> }
>
> @Autowired
> SalesforceComponent sfdcComp;
>
> @Override
> public void afterApplicationStart(CamelContext camelContext) {
>
> try {
> sfdcComp.start();
> camelContext.startRoute("salesforce-versions");
> Route theRoute = camelContext.getRoute("salesforce-versions");
> Endpoint ep = theRoute.getEndpoint();
>
> Exchange exchange = ep.createExchange();
> ProducerTemplate template =
> exchange.getContext().createProducerTemplate();
> DefaultExchange o = (DefaultExchange) template.request(ep, new
> Processor() {
>
> @Override
> public void process(Exchange exchange) throws Exception {
> // TODO Auto-generated method stub
>
> }
> });
> Object result = o.getOut().getBody();
> if(result == null && !(result instanceof ArrayList))
> throw new Exception("No Salesforce version, login
> failed.");
>
> ArrayList theList = (ArrayList) result;
> if(theList.size() <= 1)
> throw new Exception("No Salesforce version got, login
> failed.");
> log.debug("Connection to salesforce successfully
> established:");
>
> } catch (Exception e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> throw new RuntimeException("No Connection to salesforce");
> }
>
> }
> In this code, i saw during my debugging that it was able to start the
> routes in camelcontext object and get the endpoints, however with version
> 2.20.0 I see my routes are not added to the camelcontext and no routes 

Re: Camel Spring Boot: Bean initialization skipped in auto-configuration

2017-10-12 Thread Mark Nuttall
Sorry. I guess my reply was not clear.  I wasn't saying it need changes. I
was just saying (and i tried it about a year ago) is that Spring Boot needs
a little config to expose things "correctly" when using that component.
That article was the first one i came too when i googled. :(  Maybe it
doesn't anymore? :)

I was only trying to figure out what might possible cause the issue he was
seeing. And also to give him a work around.

On Thu, Oct 12, 2017 at 8:27 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:

> On Thu, Oct 12, 2017 at 2:20 PM, Mark Nuttall <mknutt...@gmail.com> wrote:
> > well that does sound like an issue with the camel-http-starter component
> > and would be something for the maintainers.
> > If i remember rightly, using that component with spring boot requires
> some
> > minor coding additions to get things to work (i.e. like this -
> > http://www.frommknecht.net/spring-boot-meets-apache-camel/). It might be
> > related.
> >
> > So, what I suggest is just use Spring Controllers instead. It is VERY
> easy
> > to do and just use the producerTemplate to send thing to camel routes.
> This
> > is what I do.
> >
>
> No camel-http-starter does not need any changes.
> That link your provided is to some old article from 2014.
>
> Sure spring-mvc is a good web library and you can easily integrate
> with with Camel with producer templates or other means.
>
> > On Thu, Oct 12, 2017 at 4:12 AM, Florian Posch <
> > florian.po...@performgroup.com> wrote:
> >
> >> Hi,
> >>
> >> Thanks for your swift reply.
> >>
> >> As mentioned in the Stackoverflow question, it is not a matter of
> generic
> >> objects like Map<> or Object because injection of a domain-specific
> class
> >> doesn't work either.
> >>
> >> Finally, I've found out what could potentially cause the problem: For my
> >> case, it depends on whether camel-http-starter is on the classpath or
> not.
> >> If I remove that dependency MyInflightRepositorys' data field gets
> >> injected, otherwise not. Not sure if this makes any sense in the given
> >> sample but that changes our application's behaviour...
> >>
> >> See https://github.com/DoNuT1985/camel-dependency-sample
> >>
> >> I hope this helps.
> >>
> >> Kind regards,
> >> Florian
> >>
> >>
> >>
> >>
> >> Florian Posch // Software Engineer
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> T   -
> >>
> >> RunningBall Sports Information GmbH
> >> M  -
> >>
> >> Plabutscher Straße 63
> >> F   -
> >>
> >> 8051 Graz
> >> E   florian.po...@performgroup.com
> >>
> >> Austria
> >> Skype rb.fposch
> >>
> >>
> >>
> >>
> >> W www.performgroup.com
> >>
> >>
> >> -Ursprüngliche Nachricht-
> >> Von: Mark Nuttall [mailto:mknutt...@gmail.com]
> >> Gesendet: Mittwoch, 11. Oktober 2017 13:45
> >> An: users@camel.apache.org
> >> Betreff: Re: Camel Spring Boot: Bean initialization skipped in
> >> auto-configuration
> >>
> >> I looked at stacktrace and your code here. I agree with the comment
> about
> >> the Map. The same thing can happen with strings. I am not sure what the
> map
> >> does but you might be able to that in Spring properties. If not, either
> >> create a class to hold the map and make that class the Bean or provide a
> >> name to the Bean and make sure you use that when you inject the bean.
> >>
> >> I think we are going to need a copy of code that does not work. I use
> >> Spring Boot and Camel pretty extensively and while it is not without
> >> issues, it was usually due to me doing something probably I shouldnt
> have
> >> or there was a better way. :)
> >>
> >> Also, as suggested, use constructor injection. The version of Boot you
> are
> >> using makes it very easy - all you need is a single constructor on your
> >> managed object (to include the RouteBuilder). And if you use Lombok, it
> is
> >> even easier.
> >>
> >> Mark
> >>
> >> On Wed, Oct 11, 2017 at 4:41 AM, Florian Posch <
> >> florian.po...@performgroup.com> wrote:
> >>
> >> > Hi,
> >> >
> >> > I'm using Camel 2.19.3 and Spring Boot 1.5.7 including the
> &g

Re: Camel Spring Boot: Bean initialization skipped in auto-configuration

2017-10-12 Thread Mark Nuttall
well that does sound like an issue with the camel-http-starter component
and would be something for the maintainers.
If i remember rightly, using that component with spring boot requires some
minor coding additions to get things to work (i.e. like this -
http://www.frommknecht.net/spring-boot-meets-apache-camel/). It might be
related.

So, what I suggest is just use Spring Controllers instead. It is VERY easy
to do and just use the producerTemplate to send thing to camel routes. This
is what I do.

On Thu, Oct 12, 2017 at 4:12 AM, Florian Posch <
florian.po...@performgroup.com> wrote:

> Hi,
>
> Thanks for your swift reply.
>
> As mentioned in the Stackoverflow question, it is not a matter of generic
> objects like Map<> or Object because injection of a domain-specific class
> doesn't work either.
>
> Finally, I've found out what could potentially cause the problem: For my
> case, it depends on whether camel-http-starter is on the classpath or not.
> If I remove that dependency MyInflightRepositorys' data field gets
> injected, otherwise not. Not sure if this makes any sense in the given
> sample but that changes our application's behaviour...
>
> See https://github.com/DoNuT1985/camel-dependency-sample
>
> I hope this helps.
>
> Kind regards,
> Florian
>
>
>
>
> Florian Posch // Software Engineer
>
>
>
>
>
>
>
>
>
>
>
> T   -
>
> RunningBall Sports Information GmbH
> M  -
>
> Plabutscher Straße 63
> F   -
>
> 8051 Graz
> E   florian.po...@performgroup.com
>
> Austria
> Skype rb.fposch
>
>
>
>
> W www.performgroup.com
>
>
> -Ursprüngliche Nachricht-
> Von: Mark Nuttall [mailto:mknutt...@gmail.com]
> Gesendet: Mittwoch, 11. Oktober 2017 13:45
> An: users@camel.apache.org
> Betreff: Re: Camel Spring Boot: Bean initialization skipped in
> auto-configuration
>
> I looked at stacktrace and your code here. I agree with the comment about
> the Map. The same thing can happen with strings. I am not sure what the map
> does but you might be able to that in Spring properties. If not, either
> create a class to hold the map and make that class the Bean or provide a
> name to the Bean and make sure you use that when you inject the bean.
>
> I think we are going to need a copy of code that does not work. I use
> Spring Boot and Camel pretty extensively and while it is not without
> issues, it was usually due to me doing something probably I shouldnt have
> or there was a better way. :)
>
> Also, as suggested, use constructor injection. The version of Boot you are
> using makes it very easy - all you need is a single constructor on your
> managed object (to include the RouteBuilder). And if you use Lombok, it is
> even easier.
>
> Mark
>
> On Wed, Oct 11, 2017 at 4:41 AM, Florian Posch <
> florian.po...@performgroup.com> wrote:
>
> > Hi,
> >
> > I'm using Camel 2.19.3 and Spring Boot 1.5.7 including the
> > corresponding Camel starter for my application and am having some
> > issues with a custom InflightRepository getting set up.
> >
> > It is defined as Spring @Component and should get applied to the
> > context by auto-configuration but the problem is that the bean isn't
> > properly initialized
> >
> > @Component
> > public class MyInflightRepository extends
> > DefaultInflightRepository {
> >
> > @Autowired
> > private MyInjectedBean bean;
> >
> > // ...
> > }
> >
> >
> > The repository gets applied to the CamelContext as well as it is
> > available but to me it looks as if premature bean access in
> > CamelAutoConfiguration.afterPropertiesSet
> > causes the bean not being initialiized properly (so @Autowired members
> > remain null but Spring starts up without an error). As far as I
> > understood this happens because Application.getBeansByType(...) gets
> > called before all property resolvers are initialized.
> >
> > I was able to work around that by manually initializing my
> > InflightRepository and setting it in a CamelConfiguration bean but for
> > my taste this is a bit dangerous to scan for custom beans that might
> > not get initialized properly during startup.
> >
> > There's a more detailed snippet given on my Stackoverflow post:
> > https://stackoverflow.com/questions/46680985/spring-
> > boot-camel-autowiring-issues-in-camel-components
> >
> > Any question, please let me know...
> >
> > Kind regards,
> > Florian
> >
> > Florian Posch // Software Engineer
> >
> >
> >
> >
>

Re: Camel Spring Boot: Bean initialization skipped in auto-configuration

2017-10-11 Thread Mark Nuttall
I looked at stacktrace and your code here. I agree with the comment about
the Map. The same thing can happen with strings. I am not sure what the map
does but you might be able to that in Spring properties. If not, either
create a class to hold the map and make that class the Bean or provide a
name to the Bean and make sure you use that when you inject the bean.

I think we are going to need a copy of code that does not work. I use
Spring Boot and Camel pretty extensively and while it is not without
issues, it was usually due to me doing something probably I shouldnt have
or there was a better way. :)

Also, as suggested, use constructor injection. The version of Boot you are
using makes it very easy - all you need is a single constructor on your
managed object (to include the RouteBuilder). And if you use Lombok, it is
even easier.

Mark

On Wed, Oct 11, 2017 at 4:41 AM, Florian Posch <
florian.po...@performgroup.com> wrote:

> Hi,
>
> I'm using Camel 2.19.3 and Spring Boot 1.5.7 including the corresponding
> Camel starter for my application and am having some issues with a custom
> InflightRepository getting set up.
>
> It is defined as Spring @Component and should get applied to the context
> by auto-configuration but the problem is that the bean isn't properly
> initialized
>
> @Component
> public class MyInflightRepository extends
> DefaultInflightRepository {
>
> @Autowired
> private MyInjectedBean bean;
>
> // ...
> }
>
>
> The repository gets applied to the CamelContext as well as it is available
> but to me it looks as if premature bean access in 
> CamelAutoConfiguration.afterPropertiesSet
> causes the bean not being initialiized properly (so @Autowired members
> remain null but Spring starts up without an error). As far as I understood
> this happens because Application.getBeansByType(...) gets called before
> all property resolvers are initialized.
>
> I was able to work around that by manually initializing my
> InflightRepository and setting it in a CamelConfiguration bean but for my
> taste this is a bit dangerous to scan for custom beans that might not get
> initialized properly during startup.
>
> There's a more detailed snippet given on my Stackoverflow post:
> https://stackoverflow.com/questions/46680985/spring-
> boot-camel-autowiring-issues-in-camel-components
>
> Any question, please let me know...
>
> Kind regards,
> Florian
>
> Florian Posch // Software Engineer
>
>
>
>
>
>
>
>
>
>
>
> T   -
>
> RunningBall Sports Information GmbH
> M  -
>
> Plabutscher Straße 63
> F   -
>
> 8051 Graz
> E   florian.po...@performgroup.com
>
> Austria
> Skype rb.fposch
>
>
>
>
> W www.performgroup.com
>
>
>


Re: Design: Caching JPA Entities in Apache Camel

2017-10-07 Thread Mark Nuttall
if you are going to still use JPA, Spring Boot works very well with camel
and makes caching jpa entities seamless (implementation is in property
files)

On Sat, Oct 7, 2017 at 11:31 AM, Rafael Soares  wrote:

> If you choose Hibernate as your JPA provider you can activate entity 2nd
> level caching [1] with Infinispan [2]. Or use Infinispan as a general
> purpose (not only for JPA entities) Distributed cache. In the latter case,
> there is a Camel component to interact with Infinispan caches [3].
>
> [1]
> https://docs.jboss.org/hibernate/orm/5.2/userguide/
> html_single/Hibernate_User_Guide.html#caching
> [2] http://infinispan.org
> [3] http://camel.apache.org/infinispan.html
>
> 
> Rafael Torres Coelho Soares
>
> On Sat, Oct 7, 2017 at 7:58 AM, Imran Raza Khan 
> wrote:
>
> > I have currently project to which i planning to migrate to Apache camel.
> >
> > It exposes API to inquire for different Inventory stored in DB.
> > These Inventory model doesn't change frequently and new Inventory got
> > update once in two months.
> > Currently at start of Application i load all entities(Inventory,
> > SystemConfig, and couple of related entities ) from DB and stored in
> > HashMap's of my developed CacheManager class.
> > For any new changes we restart the application.
> >
> > Now looking for some more better options in ApacheCamel
> >
> > Should I cache the data or hit the database?
> > Use Cache providers like Redis, EhCache, Hazelcast or custom cache.
> > But should not overkill too or keeping future growth in mind i should
> > try some third party provider so in future i would not require to re
> > design from scratch if go for clustering. Currently its deployed on
> > two individual servers with hardware load balance on front.
> >
>


Re: REST DSL process multipart/form-data binary file?

2017-09-30 Thread Mark Nuttall
it is just a file. any example of processing a file should work.  you will
be able to save it somewhere and then you will have to call some processor
to read/process it.

On Fri, Sep 29, 2017 at 7:47 PM, Mark  wrote:

> I'm trying to figure out how to process a binary file that is sent to my
> Camel REST service via POST.  I have not found any good examples on how
> this can be done using Camel.  Does anyone have any experiences they could
> share or links to more documentation?
>
> I'm currently using the jetty component for the restconfiguration.
>
> Thanks,
> Mark
>


Re: Out Of Memory Using Camel 2.18.2 , Secure Kafka 0.10.2 , Spring Boot 1.5.1

2017-05-09 Thread Mark Nuttall
Was this part of another thread?

Anyway, what are the current memory settings? My guess i that you are
reading a quite large message into memory.  Either increase memory or
stream the message to disk (like how the FTP client does it). I am not sure
offhand if the Kafka component supports it.

On Mon, May 8, 2017 at 10:21 PM, 29722kumar  wrote:

> Out Of Memory Using Camel 2.18.2 , Secure Kafka 0.10.2 , Spring Boot 1.5.1
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Out-Of-Memory-Using-Camel-2-18-2-Secure-Kafka-0-10-2-
> Spring-Boot-1-5-1-tp5799123.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: AWS S3 and Minio (or other S3 emulator)

2017-04-27 Thread Mark Nuttall
Thanks. I was thinking the same after looking at the free tier. It is for
work though and I didn't want my info in our environment.  I might stlll do
it.

I forged ahead with just using Minio with a processor. I might make up an
endpoint that better emulates the S3 one and put it on github.

On Thu, Apr 27, 2017 at 5:28 PM, <dennyej...@yahoo.com.invalid> wrote:

> Why don't u go for a free tier account and use S3? I'm using it with camel
> and java sdk .. works well..
>
> Sent from my Cyanogen phone
>
> On Apr 25, 2017 8:59 AM, Mark Nuttall <mknutt...@gmail.com> wrote:
>
> Does anyone have experience using Camel with an AWS S3 "emulator". I don't
> currently have access to AWS S3 so i am trying to use Minio (Minio.io) to
> develop with until I can get the real S3. I have not been successful
> getting it to work. I have tried creating the AmazonS3Client myself but am
> running into a myriad of errors.  I've tried a few different things. I did
> have to drop back to a previous version of Minio because of a known bug
> with it and the  Amazon Java API.
>
> If you have used one, what did you use and how did you get the AWS S3
> component to work with it?
>
> Thanks!
> Mark
>
>


Re: Audit Database with Apache Camel

2017-04-25 Thread Mark Nuttall
If you use  Hibernate (or Spring JPA with Hibernate (as the provider) with
Camel there is Hibernate Envers for RDBMS. Spring also provides "auditing"
for web calls too. I don't spend any time with anything else so I am not
sure but I have not run across anything.

On Tue, Apr 25, 2017 at 10:10 AM, andcrow  wrote:

> Still in this battle, because the *"WINTER IS COMING"*... lol hehehe
>
> Does Apache Camel have any component that can perform auditing on a
> database? Or audit records that will be sent to a web service using a JSON
> file?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Audit-Database-with-Apache-Camel-tp5798257.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


AWS S3 and Minio (or other S3 emulator)

2017-04-25 Thread Mark Nuttall
Does anyone have experience using Camel with an AWS S3 "emulator". I don't
currently have access to AWS S3 so i am trying to use Minio (Minio.io) to
develop with until I can get the real S3. I have not been successful
getting it to work. I have tried creating the AmazonS3Client myself but am
running into a myriad of errors.  I've tried a few different things. I did
have to drop back to a previous version of Minio because of a known bug
with it and the  Amazon Java API.

If you have used one, what did you use and how did you get the AWS S3
component to work with it?

Thanks!
Mark


Re: SEDA vs embedded ActiveMQ

2017-03-29 Thread Mark Nuttall
Thanks for the reply.

Yeah, it will just be simple pub/sub, no topics or message expiration. So,
I think I will switch to SEDA.


On Wed, Mar 29, 2017 at 9:53 AM, Quinn Stevenson <
qu...@pronoia-solutions.com> wrote:

> IMO, if you need features that ActiveMQ provides (publish/subscribe
> semantics (JMS Topics), message expiration, Virtual Topics) then an
> Embedded ActiveMQ broker makes sense.  If SEDA does what you need, I think
> I’d stick with that.
>
> > On Mar 29, 2017, at 6:23 AM, Mark Nuttall <mknutt...@gmail.com> wrote:
> >
> > Note that i will be using **embedded** ActiveMQ. (I tried to highlight
> that
> > in my question) Thus it will _not_ have persistence, reliability or be
> > distributed.
> >
> > So, in light that, does embedded ActiveMQ add any value over SEDA? Or
> does
> > it just add overhead (i.e. more memory, etc)?
> >
> > On Wed, Mar 29, 2017 at 8:12 AM, Muhzin <rmuh...@gmail.com> wrote:
> >
> >> The documentation of SEDA has the necessary clarification.
> >>
> >>
> >> The *seda:* component provides asynchronous SEDA
> >>> <http://www.eecs.harvard.edu/~mdw/proj/seda/> behavior, so that
> messages
> >>> are exchanged on a BlockingQueue
> >>> <http://java.sun.com/j2se/1.5.0/docs/api/java/util/
> >> concurrent/BlockingQueue.html> and
> >>> consumers are invoked in a separate thread from the producer.
> >>> This component does not implement any kind of persistence or recovery,
> if
> >>> the VM terminates while messages are yet to be processed. *If you need
> >>> persistence, reliability or distributed SEDA, try using either JMS
> >>> <http://camel.apache.org/jms.html> or ActiveMQ
> >>> <http://camel.apache.org/activemq.html>.*
> >>
> >>
> >> On Wed, Mar 29, 2017 at 5:33 PM, Mark Nuttall <mknutt...@gmail.com>
> wrote:
> >>
> >>> Which would be the better choice?  SEDA or _embedded_ ActiveMQ?
> >>>
> >>> I've googled and read the docs.  I am just doing some low volume, short
> >>> live processing and need async worker queues. My only other choice is
> SQS
> >>> and it seems like overkill and a lot of extra effort.
> >>>
> >>
> >>
> >>
> >> --
> >> BR
> >> Muhsin
> >>
>
>


Re: SEDA vs embedded ActiveMQ

2017-03-29 Thread Mark Nuttall
Note that i will be using **embedded** ActiveMQ. (I tried to highlight that
in my question) Thus it will _not_ have persistence, reliability or be
distributed.

So, in light that, does embedded ActiveMQ add any value over SEDA? Or does
it just add overhead (i.e. more memory, etc)?

On Wed, Mar 29, 2017 at 8:12 AM, Muhzin <rmuh...@gmail.com> wrote:

> The documentation of SEDA has the necessary clarification.
>
>
> The *seda:* component provides asynchronous SEDA
> > <http://www.eecs.harvard.edu/~mdw/proj/seda/> behavior, so that messages
> > are exchanged on a BlockingQueue
> > <http://java.sun.com/j2se/1.5.0/docs/api/java/util/
> concurrent/BlockingQueue.html> and
> > consumers are invoked in a separate thread from the producer.
> > This component does not implement any kind of persistence or recovery, if
> > the VM terminates while messages are yet to be processed. *If you need
> > persistence, reliability or distributed SEDA, try using either JMS
> > <http://camel.apache.org/jms.html> or ActiveMQ
> > <http://camel.apache.org/activemq.html>.*
>
>
> On Wed, Mar 29, 2017 at 5:33 PM, Mark Nuttall <mknutt...@gmail.com> wrote:
>
> > Which would be the better choice?  SEDA or _embedded_ ActiveMQ?
> >
> >  I've googled and read the docs.  I am just doing some low volume, short
> > live processing and need async worker queues. My only other choice is SQS
> > and it seems like overkill and a lot of extra effort.
> >
>
>
>
> --
> BR
> Muhsin
>


SEDA vs embedded ActiveMQ

2017-03-29 Thread Mark Nuttall
Which would be the better choice?  SEDA or _embedded_ ActiveMQ?

 I've googled and read the docs.  I am just doing some low volume, short
live processing and need async worker queues. My only other choice is SQS
and it seems like overkill and a lot of extra effort.


Re: can Redis BLPOP (and etc) be used in a consumer URI?

2017-03-29 Thread Mark Nuttall
Thanks. That is what I saw too. I dug through the code and I didnt see any
thing else supported. I was hoping for a sanity check. :)

Anyway, since Redis pub/sub seems to add no value over embedded activemq or
SEDA, and actually means an external dependency, I am not going to use
Redis for queues. I guess it (Redis Pub/Sub) is for platforms that don't
have the options that Java has.

On Wed, Mar 29, 2017 at 12:46 AM, Tomohisa Igarashi <tm.igara...@gmail.com>
wrote:

> Hi,
>
> I don't know much about Redis though, it seems the PSUBSCRIBE and
> SUBSCRIBE are the only two supported for consumer.
> https://github.com/apache/camel/blob/master/components/camel
> -spring-redis/src/main/java/org/apache/camel/component/
> redis/RedisConsumer.java#L54
>
> You may want to file a JIRA for the enhancement.
>
> Thanks,
> Tomo
>
>
> On 03/29/2017 03:23 AM, Mark Nuttall wrote:
>
>> I am looking at the documentation and examples and have been testing with
>> the Redis component. It seems that the only command that will work in a
>> consumer URI is SUBSCRIBE  and PSUBSCRIBE . It seems that only works with
>> PUBLISH. Pub/Sub in REDIS is not persistent. I need  something that is. If
>> i put anything other than subscribe or psubscribe, i get an unsupported
>> error. I need to be able to have a "from" that blocks on BPLOP. The
>> example
>> code uses "sendHeaders" in the via the test helper class but does not
>> block.
>>
>> (fyi, i'd use ActiveMQ but "we" are switching to SQS and that comes with
>> another host of issues and i just need some worker queues)
>>
>> Any ideas?
>>
>>


can Redis BLPOP (and etc) be used in a consumer URI?

2017-03-28 Thread Mark Nuttall
I am looking at the documentation and examples and have been testing with
the Redis component. It seems that the only command that will work in a
consumer URI is SUBSCRIBE  and PSUBSCRIBE . It seems that only works with
PUBLISH. Pub/Sub in REDIS is not persistent. I need  something that is. If
i put anything other than subscribe or psubscribe, i get an unsupported
error. I need to be able to have a "from" that blocks on BPLOP. The example
code uses "sendHeaders" in the via the test helper class but does not block.

(fyi, i'd use ActiveMQ but "we" are switching to SQS and that comes with
another host of issues and i just need some worker queues)

Any ideas?


Re: Recommend a platform for running Camel

2017-03-13 Thread Mark Nuttall
It is. :)  There are other ways. As fully featured? (aka 12 factored app).
I've not found it. FYI - You will need more than just Docker (see the
things I mentioned).

I was on my tablet at work earlier so it was tough to type and send links.
So, for completeness, here is the link to Spring Boot Admin
https://github.com/codecentric/spring-boot-admin
and a video -
https://spring.io/blog/2016/12/07/spring-tips-bootiful-dashboards


On Mon, Mar 13, 2017 at 5:28 PM, mtod09  wrote:

> Thanks Mark,
>
> I was just logging on to ask that exact question. The Spring Boot seems
> like
> a pretty clean way of packaging and delivering Camel to Docker.
>
> Mike
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Recommend-a-platform-for-running-Camel-tp5795331p5795397.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Recommend a platform for running Camel

2017-03-13 Thread Mark Nuttall
You can use spring boot admin to do some admin. Eventually you will want to
use something like  fabric8\kubernetes or cloudfoundry to manage spring
boot apps. All the goodness in it makes it "easy" to manage. Starting with
spring boot admin might be a way to go while you figure out kubernetes.

On Mar 13, 2017 10:34 AM, "mtod09"  wrote:

> Thanks Christian,
>
> I agree I think we will need more ability to manage the processes as we
> scale.
>
> I tried the SpringBoot approach over the weekend very easy to get going but
> I'm not seeing any way to manage a large number of processes.
>
> On to the next option fabric8/kubernetes.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Recommend-a-platform-for-running-Camel-tp5795331p5795364.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel + Springboot Horizontal Scalability

2017-03-04 Thread Mark Nuttall
Check out Fabric8 and Kubernetes

On Mar 4, 2017 1:37 PM, "contactreji"  wrote:

> Hi Guys
>
> Has anyone tried horizontal scaling of camel springboot apps on cloud
> platforms or open stack platforms? If so how can we achieve that?
>
> Cheers
> Reji
>
>
>
> -
> Reji Mathews
> Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel
> & Jboss Fuse ESB | Mule ESB )
> LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
> Twitter - reji_mathews
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Camel-Springboot-Horizontal-Scalability-tp5794852.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: CamelConfiguration wires all routes by default

2017-02-10 Thread Mark Nuttall
Maybe a code example of what you are trying?

 I am using spring, well spring boot , and Camel to dynamically create
routes on demand.

On Feb 10, 2017 1:31 PM, "Luciano Nunes"  wrote:

Nobody?



--
View this message in context: http://camel.465427.n5.nabble.
com/CamelConfiguration-wires-all-routes-by-default-tp5793727p5793772.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to convert property value to array

2016-11-08 Thread Mark Nuttall
I did some googling and i cannot find an exact example. But based on what i
see in the Simple and Properties pages, i am guessing that it might work
like Spring.  So in your properties file try this:

cool.foos[0]=a
cool.foos[0]=b
cool.foos[0]=c

and in your DSL use:

 " ${properties:cool.foos} "


On Tue, Nov 8, 2016 at 3:40 PM, imranrazakhan 
wrote:

> I am using Java DSL.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/How-to-convert-property-value-to-array-tp5789924p5789926.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: How to convert property value to array

2016-11-08 Thread Mark Nuttall
Are you using spring?  Creating arrays from properties is built in.

On Nov 8, 2016 3:07 PM, "imranrazakhan"  wrote:

> HI,
>
> I want to convert value to array but couldn't get any idea from docs
>
> // properties
> cool.foo=a,b,c
>
>
> // route
> from("direct:start")
>   .setHeader("myList",  simple(" ${properties:cool.foo} ") })
>   .to("direct:end"}");
>
> Currently myList valuse is string like a,b,c
>
> How i can treat myList as array?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/How-to-convert-property-value-to-array-tp5789924.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: IDE for newer Camel versions using Camel Spring Boot

2016-10-24 Thread Mark Nuttall
Fyi STS has property autocompletion with docs :).

I recommend Claus's video. I was going to mention it but figured he would.

On Oct 24, 2016 3:18 AM, "Claus Ibsen"  wrote:

> Hi
>
> There is also the fabric8 Camel forge tooling for Apache Camel
> http://fabric8.io/guide/forge.html
>
> As well the maven plugin to validate your Camel endpoints/expressions
> http://fabric8.io/guide/camelMavenPlugin.html
>
> The forge tooling works in any IDE such as Eclipse, IDEA or NetBeans.
> I recorded a video in the start of the year
> http://www.davsclaus.com/2015/12/video-of-apache-camel-
> tooling-to-edit.html
>
> For graphical drag and drop then there is as you say JBoss Eclipse
> tooling for Camel where a new version was recently released that
> support Camel 2.17.x
> http://lhein.blogspot.se/2016/10/jboss-fuse-tooling-80-for-
> eclipse-mars.html
>
> The real power of Camel is that you do NOT need any tooling, its just
> java, scala, groovy or xml code. The more skilled (Camel) developers I
> hear just uses their IDE of choice/
>
> Though for Spring Boot users I do like the auto completion tooling
> that IDEA has when editing application.properties where you can get
> code assistance to see all the options you can configure, and with
> documentation.
>
>
>
> On Sun, Oct 23, 2016 at 9:35 PM, Pontus Ullgren  wrote:
> > Hi,
> >
> > I know about JBoss Tools Camel Tooling and been using it. It works great
> as
> > long as we stayed with the RedHat supported versions of Camel and JBoss
> > Fuse. But lately we have moved away from this and going with Camel Spring
> > Boot and more up to date versions of Camel.
> >
> > The main reason for this is to get new features faster.
> >
> > The problem now is that JBoss Tools does not handle this combination
> well.
> > But that is a JBoss specific issue so that is not what I want to discuss
> > here. There is other forums for this.
> >
> > Instead my question: What do you use for developing your Camel based
> > applications ?
> > I quickly tested Spring Tool Suite which kind of give us most of what we
> > look for including good support for gradle. But hope to get some more
> > suggestions.
> >
> > We mostly use the Spring XML DSL to define the routes but also some Java
> > DSL.
> > Code completion and some tooltips in XML editing mode is a requirement.
> > Graphical visualisation and editing of the routes is a bonus but I assume
> > that JBoss Tools is the only one that supports this.
> >
> > Thanks for any insight you can share
> > Pontus
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: IDE for newer Camel versions using Camel Spring Boot

2016-10-23 Thread Mark Nuttall
Pontus, I only do Java DSL with Spring Boot, so I use STS (I could use
Intellij too if I had a license for it). It works very well for me (and my
use cases). The guy i use to work with started with XML but it was painful
because - XML. He has moved exclusively to Groovy. I am not sure what your
use case for XML is, but Groovy might solve it (since it can be run as a
program or as a script)

Mark

On Sun, Oct 23, 2016 at 4:45 PM, souciance  wrote:

> Hi Pontus
>
> I use Intellij for the actual coding and I find that Intellj works faster
> and cleaner than Eclipse which I used before. The maven integration is also
> good and the git integration is really nice. I work mainly with the java
> dsl and use blueprint for route configuration and deployment to Karaf as
> the runtime model, with everything running in docker. I did try JBoss Tools
> and the graphical visualisation but I think the release needs a few more
> updates to become more stable. I run into some errors and it was quit slow
> to work with.
>
> Best
> Souciance
>
>
>
> On Sun, Oct 23, 2016 at 9:36 PM, pontus.ullgren [via Camel] <
> ml-node+s465427n5789147...@n5.nabble.com> wrote:
>
> > Hi,
> >
> > I know about JBoss Tools Camel Tooling and been using it. It works great
> > as
> > long as we stayed with the RedHat supported versions of Camel and JBoss
> > Fuse. But lately we have moved away from this and going with Camel Spring
> > Boot and more up to date versions of Camel.
> >
> > The main reason for this is to get new features faster.
> >
> > The problem now is that JBoss Tools does not handle this combination
> well.
> > But that is a JBoss specific issue so that is not what I want to discuss
> > here. There is other forums for this.
> >
> > Instead my question: What do you use for developing your Camel based
> > applications ?
> > I quickly tested Spring Tool Suite which kind of give us most of what we
> > look for including good support for gradle. But hope to get some more
> > suggestions.
> >
> > We mostly use the Spring XML DSL to define the routes but also some Java
> > DSL.
> > Code completion and some tooltips in XML editing mode is a requirement.
> > Graphical visualisation and editing of the routes is a bonus but I assume
> > that JBoss Tools is the only one that supports this.
> >
> > Thanks for any insight you can share
> > Pontus
> >
> >
> > --
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://camel.465427.n5.nabble.com/IDE-for-newer-Camel-
> > versions-using-Camel-Spring-Boot-tp5789147.html
> > To start a new topic under Camel - Users, email
> > ml-node+s465427n465428...@n5.nabble.com
> > To unsubscribe from Camel - Users, click here
> >  unsubscribe_by_code=465428=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> BnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > .
> > NAML
> >  viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.
> BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.view.web.template.NodeNamespace=
> notify_subscribers%21nabble%3Aemail.naml-instant_emails%
> 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/IDE-for-newer-Camel-versions-using-Camel-Spring-
> Boot-tp5789147p5789148.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Spring Boot autoconfiguration

2016-10-21 Thread Mark Nuttall
It might be easier and better to move that code to a different project. It
sounds like you have non camel specific code you want to test.

On Oct 20, 2016 11:15 PM, "Minh Tran"  wrote:

> Hi
>
> I’m using Camel 2.18.0 and Spring Boot. I’m trying to write a unit test
> that excludes any Camel from starting up.
>
> Prior to 2.18.0, I could do this by simply excluding
> CamelAutoConfiguration. But now in 2.18.0, it looks like a whole bunch of
> other AutoConfiguration for Camel has been added. So far I’ve added about
> 20 extra classes to exclude before I gave up. Here is what I have so far
>
> @RunWith(SpringJUnit4ClassRunner.class)
> @SpringBootTest
> public class PlainTest {
>
> @Configuration
> @EnableAutoConfiguration(exclude = {
> CamelAutoConfiguration.class, DirectComponentAutoConfiguration.class,
> DirectVmComponentAutoConfiguration.class,
> LogComponentAutoConfiguration.class,
> PropertiesComponentAutoConfiguration.class, RestComponentAutoConfiguration
> .class,
> SchedulerComponentAutoConfiguration.class,
> SedaComponentAutoConfiguration.class, StubComponentAutoConfiguration
> .class,
> ValidatorComponentAutoConfiguration.class,
> VmComponentAutoConfiguration.class, XsltComponentAutoConfiguration.class,
> GzipDataFormatAutoConfiguration.class,
> SerializationDataFormatAutoConfiguration.class,
> StringDataFormatAutoConfiguration.class,
> ZipDataFormatAutoConfiguration.class,
> BeanLanguageAutoConfiguration.class, ConstantLanguageAutoConfigurat
> ion.class,
> HeaderLanguageAutoConfiguration.class })
> public static class Config {
>
> }
>
> @Test
> public void test() {
> // do something
> }
> }
>
>
> Could someone tell me the proper way of excluding Camel in my unit tests?
> Thanks.
>
>
>


Re: Camel Context Metrics

2016-08-15 Thread Mark Nuttall
Another way - if you are using Spring, Spring Boot has exporters built in
to export metrics.

On Mon, Aug 15, 2016 at 12:02 PM, Rajith Muditha Attapattu <
rajit...@gmail.com> wrote:

> Thank you James!
>
> On Mon, Aug 15, 2016 at 11:35 AM, James Strachan
>  wrote:
> > Prometheus is an awesome way to collect metrics from containers, JVMs,
> > Camel contexts and other processes:
> > https://prometheus.io/
> >
> > We use it in fabric8 (http://fabric8.io/) to collect metrics from docker
> > containers, kubernetes and any JVM which contains JMX or Camel.
> >
> > Adding Agent Bond to any JVM enables it for Jolokia management/operations
> > and Prometheus monitoring:
> > https://github.com/fabric8io/agent-bond
> >
> > (we do this by default to any project created in fabric8)
> >
> > We then get a Camel dashboard for all containers running Camel OOTB. To
> see
> > an example check out (13:10) in this video: https://vimeo.com/173353537
> >
> > On 15 August 2016 at 16:30, Rajith Muditha Attapattu  >
> > wrote:
> >
> >> Hey All,
> >>
> >> I'm aware of the hawt.io plugin that connects to a Camel Context and
> >> pulls info via JMX.
> >>
> >> For performance reasons, we are looking at how an application (that
> >> contains one or more Camel Context) wants to push route metrics to an
> >> external source. We have several of those apps, which is why
> >> connecting to all of them via a hawtio console want scale well.
> >>
> >> Whats the best way to gather the metrics at the application level?
> >>
> >> (After which it will be sent to an external source like elastic search)
> >>
> >>
> >> 1. Access the info from JMX (programatically)
> >>
> >>
> >> 2. Implement some sort of Listener interface to get notified.
> >>
> >>
> >> I prefer the latter, but the former is fine as well.
> >>
> >> --
> >> Regards,
> >>
> >> Rajith Muditha Attapattu
> >>
> >
> >
> >
> > --
> > James
> > ---
> > Red Hat
> >
> > Twitter: @jstrachan
> > Email: james.strac...@gmail.com
> > Blog: https://medium.com/@jstrachan/
> >
> > fabric8: http://fabric8.io/
> > open source microservices platform
>
>
>
> --
> Regards,
>
> Rajith Muditha Attapattu
>


Re: how to poll a Spring Bean in a "from" in a route to get a List to process

2016-07-20 Thread Mark Nuttall
Antoine. Thx. I might just not have been doing "bean" right.  Will give it
ago again.

On Wed, Jul 20, 2016 at 9:18 AM, Antoine DESSAIGNE <
antoine.dessai...@gmail.com> wrote:

> Hello Mark,
>
> You can use a timer [1] to trigger the processing of the route, then call
> the bean to retrieve the list of elements to process and finally process
> your elements.
>
> [1] http://camel.apache.org/timer.html
>
>
> 2016-07-20 14:29 GMT+02:00 Mark Nuttall <mknutt...@gmail.com>:
>
> > As part of a "From" in a route, I need to able to "poll" (either by time
> or
> > schedule) a spring bean (i.e. a Spring Service)  and get a List<> by
> > calling a bean's method,so that i can process each item in the list.
> I've
> > looked at "bean" and "jpa" but i am not seeing this in "bean" and I am
> not
> > using JPA per se (i.e. the Service class might modify/enhance the list
> and
> > thus is not a pure query).
> >
> > 1. can this be done?
> > 2. is there i a link to an example?
> >
> >
> > Mark
> >
>


how to poll a Spring Bean in a "from" in a route to get a List to process

2016-07-20 Thread Mark Nuttall
As part of a "From" in a route, I need to able to "poll" (either by time or
schedule) a spring bean (i.e. a Spring Service)  and get a List<> by
calling a bean's method,so that i can process each item in the list.  I've
looked at "bean" and "jpa" but i am not seeing this in "bean" and I am not
using JPA per se (i.e. the Service class might modify/enhance the list and
thus is not a pure query).

1. can this be done?
2. is there i a link to an example?


Mark