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