Claus,
Thank you for taking the time to reply.
We have multiple web applications, some of them are spring based
running in wildfly. We need to be able to bridge them, and allow
talking to an existing EJB application on the same or remote machines.
We thought using camel brings a value in keeping those applications
loosely coupled (no remote interfaces are exported).

The ejb method I am trying to invoke:

public Serializable executeTask(String taskName, Serializable params,
String dbName) throws RemoteException ;

This method is being invoked but with a single argument. For example,
everything inside the body of the exchange is passed as the first
argument. The problem is having multiple arguments. Here's my code:

List<String> params = new LinkedList<String>() {
            {
                add("taskNameValue");
                add("ParamsValue");
                add("dbNameValue");
            }
        };
String values = String.join(System.lineSeparator(), params);
from("timer:ejbTimer?period=1000")
        .setBody(simple(values))
        .to("ejb:java:global/appName/remote/MyEJB?method=executeTask") ;

This is working by invoking executeTask with arguments:

taskName = ["taskNameValue", "ParamsValue" , "dbNameValue"]
params = null
dbName = null

What I am expecting is to invoke the method with arguments:
taskName = "taskNameValue"
params = "ParamsValue"
dbName = "dbNameValue"

By setting the whole body to some value, the whole body is passed as
the first argument. If there is a way to map these arguments to the
correct method signature, then this will help me.
And by the way, if you have a better idea to achieve this, then please share it.

On Thu, 26 Aug 2021 at 11:54, Claus Ibsen <[email protected]> wrote:
>
> Hi
>
> I am not sure we understand exactly your question. The message body is
> set to a fixed String value of param-1, and then you want to call an
> EJB.
> What is the EJB method signature?
>
> And EJB can be called from regular Java so you can always just let
> Camel call a bean / processor, and from there you can call your EJB if
> something is complex.
>
> On Thu, Aug 26, 2021 at 5:16 PM Mansour Al Akeel
> <[email protected]> wrote:
> >
> > I am not sure if there is missing information preventing this question
> > from getting an answer.
> >
> > On Wed, 25 Aug 2021 at 12:08, Mansour Al Akeel
> > <[email protected]> wrote:
> > >
> > > We have a legacy system that we are trying to integrate with. The
> > > system is composed of EJB 3.0
> > >
> > > Things are fine when calling an ejb method with no arguments. However,
> > > I am unable to invoke methods with parameters.
> > >
> > > The documentation for EJB component
> > > https://camel.apache.org/components/2.x/ejb-component.html states
> > > that, we can use "parameters" as query parameters, and type is Map.
> > > Which is a bit confusing.
> > >
> > > So starting with something like:
> > >
> > > <camel:route id="ejbRoute">
> > >             <camel:from uri="timer:ejbTimer?period=1000" />
> > >             <camel:setBody>
> > >                 <camel:simple>param-1</camel:simple>
> > >             </camel:setBody>
> > >             <camel:to
> > >                 uri="ejb:java:global/app/ejbName?method=myMethod" />
> > >             <camel:log message="[Results]  ===>  ${body}" />
> > >         </camel:route>
> > >
> > > What is the correct way to pass multiple parameters to a method ?
> > >
> > > I am using camel-ejb-2.25.3
> > >
> > > Thank you in advance
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to