How to pass parameters into Mule ESB flow xml? - java

Its pretty new this Mule ESB to me. I am trying to pass parameter from the flow xml itself. Once flow started, then doTransform() method invoked and the logic inside it will be executed accordingly based on the parameter passed.
My concern is "How to pass parameter? and How can I access it from that method?"
Is there any other way please do suggest.
Thanks in Advance

Using method entry point resolver you can call a method and pass parameter.
Share your config for further help.

message.getProperty("yourVariableName", PropertyScope.SESSION);
you can use various scope here like OUTBOUND,INVOCATION,INBOUND,SESSION etc.

Related

How we can call URLGetCombinedData in java using Alchemy API with different parameters?

I am using Alchemy API for my project. I want to call a method URLGetCombinedData with different parameter. By default it has four parameter i.e concepts, entity, taxonomy and keyword. But i want to call other parameters like author, relation etc. So please help me in calling all the parameters in one call. I am using JAVA SDK.
Regards and Thanks in advance

JavaFX: Is there a best practice for a constructor replacement?

Everyone who's using JavaFX knows there is no constructor. The controllers are starting with the initialize-method.
My solution for passing things to the beginning was to create a method like setupMyController(String example);
The problem is, when another programmer changes the code he isn't forced to use this method so things which had to be passed to the controller could be null.
Does anybody know a way that can't avoid the setup?
You should use a DI container (eg. Guice) and custom controller factory

WebServiceTemplate - difference between Interceptor and Callback?

I'm trying to write my first client using Spring-WS and am getting a little confused at some basics. I need to insert a SAML token into the header, and I've noticed that the WebServiceTemplate class allows for both Interceptors and WebServiceMessageCallbacks.
Can someone please help me understand why I should use one versus another?
Secondly, I noticed that the WST class allows for a list of interceptors, but only a single callback. Does anyone know what the logic was behind that design decision? Why is there no ability to pass an array or list of Callbacks?
Thanks,
Eric
I was wondering the same after reading your question (-:
On this link there's a brief explanation and that's exactly how I use both. For instance, for a specific request I need to set the SOAP action:
JAXBElement<Response> response = (JAXBElement<Response>) webserviceTemplate.marshalSendAndReceive(
request,
new SoapActionCallback("PutOrganisationUnitRequest")
);
This is indeed a simple, anonymous class as mentioned in the link. An interceptor on the other hand is defined and used for all requests. Take a look at XwsSecurityInterceptor for instance, I use that to set the authentication on ALL requests.

How to pass the information from servlet to normal java class or java bean

How to get the information which is stored in a session of servlet from a normal java class..
As with any other class: by passing it as an argument of a constructor or method:
MyJavaClass c1 = new MyJavaClass(session.getAttribute("foo"));
MyOtherJavaClass c2 = new MyOtherJavaClass();
c2.doSomethingWithSession(session);
Generally I would make information flow from the servlet to the class: the servlet initiates the actions it requires, passing along any information that's needed to perform those actions.
I would try to isolate the other classes from any knowledge of servlets and sessions as far as possible - the servlet should know about its collaborators, rather than the other way round.
(If this doesn't help for your specific situation, please tell us more about what you're trying to do.)
HttpSession objHttpSession=request.getSession().getAttribute(#argument#);

StatelessKnowledgeSession and Drools Flow

Is it possible to run a Drools Flow process from a StatelessKnowledgeSession? If so, how? It doesn't have the startProcess(id, params) method and seems to only implement rule functionality. I have a service whose method runs a process. So far, I've used one StatefulKnowledgeSession but I read that it's not thread-safe. One solution I came up with is to inject a knowledge base and create a new session for every call of this method, but that seems like a waste of resources.
Completing the other answer,
you can use like this:
ksession.execute(CommandFactory.newStartProcess(theName, parameters));
StatelessKnowledgeSession has a method execute(..) where you can pass a set of commands. One of those could be a startProcess command.

Categories