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 <chirag.sangh...@gmail.com> 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 <mknutt...@gmail.com> 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 <girish...@gmail.com>
> 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 <mknutt...@gmail.com> 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 <claus.ib...@gmail.com>
> 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
> > > > >
> > > >
> > >
>

Reply via email to