The similar with the spring-boot runtime

camel export foo.java --runtime=spring-boot --gav=org.acme:example:0.0.1
--deps=camel-jta,dev.snowdrop:narayana-spring-boot-starter:3.2.0

On Mon, Aug 26, 2024 at 2:56 PM Zheng Feng <zf...@redhat.com> wrote:

> Thanks Claus- Hmm, but it should work with quarkus runtime, right?
>
> I just removed "transacted()" in foo.java and export it to a quarkus
> project by using
> "camel export foo.java --runtime=quarkus --gav=org.acme:example:0.0.1
> --deps=camel-jta"
>
> After that, I added "transacted()" back in the foo.java and it works fine
> with "./mvnw quarkus:dev". So is it possible to detect transacted() dsl and
> add camel-jta automatically? and run it with quarkus runtime?
>
> On Mon, Aug 26, 2024 at 2:41 PM Claus Ibsen <claus.ib...@gmail.com> wrote:
>
>> Hi
>>
>> You need to setup all that JTA transaction stuff.
>> jbang is not support doing this out of the box.
>>
>>
>> On Mon, Aug 26, 2024 at 8:01 AM Zheng Feng <zf...@redhat.com> wrote:
>>
>> > Hi,
>> >
>> > I add "transacted()" in the foo.java like
>> >
>> > public class foo extends RouteBuilder {
>> >
>> >     @Override
>> >     public void configure() throws Exception {
>> >         from("timer:java?period=1000")
>> >             .transacted()
>> >             .setBody()
>> >                 .simple("Hello Camel from ${routeId}")
>> >             .log("${body}");
>> >     }
>> > }
>> >
>> > But it is failed with running by "camel run foo.java"
>> >
>> > org.apache.camel.FailedToCreateRouteException: Failed to create route
>> > route1 at: >>> Transacted <<< in route:
>> > Route(route1)[From[timer:java?period=1000] -> [Transacted]] because of
>> > policy must be specified on:
>> > org.apache.camel.reifier.TransactedReifier@6b2dd3df
>> > at
>> >
>> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:235)
>> > at
>> org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:86)
>> > at
>> >
>> >
>> org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
>> > at
>> >
>> >
>> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:720)
>> > at
>> >
>> >
>> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:587)
>> > at
>> >
>> >
>> org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2390)
>> > at
>> org.apache.camel.support.service.BaseService.init(BaseService.java:78)
>> > at
>> >
>> >
>> org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2024)
>> > at
>> org.apache.camel.support.service.BaseService.start(BaseService.java:105)
>> > at
>> >
>> >
>> org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2043)
>> > at
>> >
>> >
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:211)
>> > at org.apache.camel.main.KameletMain.doStart(KameletMain.java:364)
>> > at
>> org.apache.camel.support.service.BaseService.start(BaseService.java:113)
>> > at
>> >
>> org.apache.camel.dsl.jbang.core.commands.Run.runKameletMain(Run.java:1336)
>> > at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:873)
>> > at org.apache.camel.dsl.jbang.core.commands.Run.doCall(Run.java:320)
>> > at
>> >
>> >
>> org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:71)
>> > at
>> >
>> >
>> org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:37)
>> > at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
>> > at picocli.CommandLine.access$1500(CommandLine.java:148)
>> > at
>> >
>> >
>> picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
>> > at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
>> > at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
>> > at
>> >
>> >
>> picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
>> > at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
>> > at picocli.CommandLine.execute(CommandLine.java:2174)
>> > at
>> >
>> >
>> org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:168)
>> > at
>> >
>> >
>> org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:61)
>> > at main.CamelJBang.main(CamelJBang.java:36)
>> > Caused by: java.lang.IllegalArgumentException: policy must be specified
>> on:
>> > org.apache.camel.reifier.TransactedReifier@6b2dd3df
>> > at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:188)
>> > at
>> >
>> >
>> org.apache.camel.reifier.TransactedReifier.createProcessor(TransactedReifier.java:41)
>> > at
>> >
>> >
>> org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:886)
>> > at
>> >
>> >
>> org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:622)
>> > at
>> >
>> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:231)
>> > ... 28 more
>> >
>> > I used the Camel JBang 4.7.0 and also try to run with "--deps=camel-jta"
>> > and "--runtime=quarkus", but none of them worked.  Is there anything I
>> > missed?
>> >
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>

Reply via email to