Converting ProcessorDefinition to DSL and interfacing with camel k

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting ProcessorDefinition to DSL and interfacing with camel k

contactreji
This might be a little wierd question. But, I was wondering if there is a
way to convert an object of org.apache.camel.model.ProcessorDefinition
object into an equivalent camel DSLs.
I have an application which constructs ProcessorDefinition object using low
level camel api's and create a camel context to start it in a jvm.

If there is a way to convert the same object into DSLs, I could possibly
think of hooking up with camel-k

Alternatively, does camel k have any interfacing to receive an object of
ProcessorDefinition object?

Cheers
Reji Mathews Sr. Engineer - Middleware Integrations / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB ) LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a Twitter - reji_mathews
Reply | Threaded
Open this post in threaded view
|

Re: Converting ProcessorDefinition to DSL and interfacing with camel k

Willem.Jiang
Administrator
I guess you just need to assemble the ProcessorDefintion into a
CamelRoute  with a CamelContext to run it in a JVM.
It's not good way to use these low level Camel APIs as there are too
much details you need to explore.

As we deploy the CamelRoute through Camel-K into K8s. It's more easy
that you just use dumped camel route into XML and deploy it through
Camel-K.

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Wed, May 27, 2020 at 9:20 AM Reji Mathews <[hidden email]> wrote:

>
> This might be a little wierd question. But, I was wondering if there is a
> way to convert an object of org.apache.camel.model.ProcessorDefinition
> object into an equivalent camel DSLs.
> I have an application which constructs ProcessorDefinition object using low
> level camel api's and create a camel context to start it in a jvm.
>
> If there is a way to convert the same object into DSLs, I could possibly
> think of hooking up with camel-k
>
> Alternatively, does camel k have any interfacing to receive an object of
> ProcessorDefinition object?
>
> Cheers
Reply | Threaded
Open this post in threaded view
|

reactive java question

Bing Lu
 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  
Reply | Threaded
Open this post in threaded view
|

Re: Converting ProcessorDefinition to DSL and interfacing with camel k

Claus Ibsen-2
In reply to this post by contactreji
Hi

No and that is not the purpose of Camel K.
Camel K is a closed-world and opinionated runtime that dont support
such very unusual and special use cases.

But on the other hand, whatever you can do from the configure() method
in a RouteBuilder is surfaced to the end user, so you can from there,
go grab xxxDefinition instances from somewhere,
and then build them on route(s). The Camel K operator does some
parsing of the code and if you do "strange" things it may not parse
accurately and if so then you need to be more specific of which Camel
JAR dependencies you use.

But I would also say that why... and maybe your existing app is not
suitable for these use cases.

On Wed, May 27, 2020 at 3:20 AM Reji Mathews <[hidden email]> wrote:

>
> This might be a little wierd question. But, I was wondering if there is a
> way to convert an object of org.apache.camel.model.ProcessorDefinition
> object into an equivalent camel DSLs.
> I have an application which constructs ProcessorDefinition object using low
> level camel api's and create a camel context to start it in a jvm.
>
> If there is a way to convert the same object into DSLs, I could possibly
> think of hooking up with camel-k
>
> Alternatively, does camel k have any interfacing to receive an object of
> ProcessorDefinition object?
>
> Cheers



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Converting ProcessorDefinition to DSL and interfacing with camel k

contactreji
Thanks for the right advice. It was just a curious question from the point
of re-usability of what we have built so far. Yes, we are looking forward
to doing it the way as suggested.

Cheers
Reji

On Wed, May 27, 2020 at 12:59 AM Claus Ibsen <[hidden email]> wrote:

> Hi
>
> No and that is not the purpose of Camel K.
> Camel K is a closed-world and opinionated runtime that dont support
> such very unusual and special use cases.
>
> But on the other hand, whatever you can do from the configure() method
> in a RouteBuilder is surfaced to the end user, so you can from there,
> go grab xxxDefinition instances from somewhere,
> and then build them on route(s). The Camel K operator does some
> parsing of the code and if you do "strange" things it may not parse
> accurately and if so then you need to be more specific of which Camel
> JAR dependencies you use.
>
> But I would also say that why... and maybe your existing app is not
> suitable for these use cases.
>
> On Wed, May 27, 2020 at 3:20 AM Reji Mathews <[hidden email]>
> wrote:
> >
> > This might be a little wierd question. But, I was wondering if there is a
> > way to convert an object of org.apache.camel.model.ProcessorDefinition
> > object into an equivalent camel DSLs.
> > I have an application which constructs ProcessorDefinition object using
> low
> > level camel api's and create a camel context to start it in a jvm.
> >
> > If there is a way to convert the same object into DSLs, I could possibly
> > think of hooking up with camel-k
> >
> > Alternatively, does camel k have any interfacing to receive an object of
> > ProcessorDefinition object?
> >
> > Cheers
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Reji Mathews Sr. Engineer - Middleware Integrations / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB ) LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a Twitter - reji_mathews
Reply | Threaded
Open this post in threaded view
|

Re: reactive java question

Mark Nuttall
In reply to this post by Bing Lu
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 <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

RE: reactive java question

Micael Kirouac
Did you take a look at camel reactive streams? https://camel.apache.org/components/latest/reactive-streams-component.html

I never tried it personally but it should support what you need to do, see the sections 'sending data to camel' and 'sending data to camel using direct api' more specifically.

-----Original Message-----
From: Mark Nuttall [mailto:[hidden email]]
Sent: Wednesday, May 27, 2020 7:48 PM
To: [hidden email]
Subject: Re: reactive java question

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 <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: reactive java question

Bing Lu
In reply to this post by Mark Nuttall
 Our code is subscriber only that consumes event from onNext() which is the starting point of the flow. We're forced to use their api which implements the onNext() function
    On Wednesday, May 27, 2020, 07:48:08 PM EDT, Mark Nuttall <[hidden email]> wrote:  
 
 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 <[hidden email]> 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
 
Reply | Threaded
Open this post in threaded view
|

Re: reactive java question

Bing Lu
 I figured it out, I can just use @produce and pump the result of the bean method to the endpoint, and once the bean method(onNext) is invoked, it will start flowing in camel. Silly me.
    On Wednesday, May 27, 2020, 08:00:41 PM EDT, Bing Lu <[hidden email]> wrote:  
 
  Our code is subscriber only that consumes event from onNext() which is the starting point of the flow. We're forced to use their api which implements the onNext() function
    On Wednesday, May 27, 2020, 07:48:08 PM EDT, Mark Nuttall <[hidden email]> wrote: 
 
 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 <[hidden email]> 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