In my SI flow I want to modify one property of the payload. At the beginning of the flow I populate a Java bean (let's call it MyFlowBean) and I send it via the difference components of the flow.
At one point I want to alter the property 'extractedValue' of this bean and I want to do it in the right way. I mean I am sure there is a component (a transformer??) where I can say e.g.
<transform propert='payload.extractedValue' value='[spEl expression]' />
Ok, I know there isn't such a tag in SI, it was just a sample.
Also I could achieve it with serviceActivator but it doesn't seem right to me to write a Java class that contain 2 lines of code and use this class in the service activator.
It has to be more elegant way.
Thanks,
V.
The Content Enricher pattern is for your and respectively the <enricher> component is present in the Spring Integration to achieve the desired goal:
<enricher>
<property name="extractedValue" expression="[spEl expression]"/>
</enricher>
Related
How should I track int-http:outbound-gateway and int-jms:outbound-channel-adapter? Below are the mapping of the component corresponding to java classes. Please verify.
I need to call setShouldTrack(true) method on the following bean so that I can fetch these component details in message-history (name,type,timestamp)
int-ws:outbound-gateway org.springframework.integration.ws.MarshallingWebServiceOutboundGateway
int-http:inbound-gateway org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway
int-http:outbound-gateway org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler
int-jms:message-driven-channel-adapter org.springframework.integration.jms.JmsSendingMessageHandler
int-jms:outbound-channel-adapter ??
Currently I am able to track int-http:inbound-gateway and int-jms:message-driven-channel-adapter.
Your question is not clear. All the MessageHandler implementations in the Framework are an extension of the AbstractMessageHandler and there is a setShouldTrack() method.
If you would like to call it manually, you can get access to them via their id. And this one is a composed id of the wrapping consumer endpoint and .handler suffix: https://docs.spring.io/spring-integration/docs/current/reference/html/overview.html#endpoint-bean-names
On the other hand it isn't clear why would one do that manually, if the <message-history> allows us to configure patterns for component names delimited with comma: https://docs.spring.io/spring-integration/docs/current/reference/html/system-management-chapter.html#message-history-config
Better explain.
What i want is a validation xml in DSL, that apply one or other xsd depending on one of the fields of the xml.
At now look like this:
Read from a MongoDB -> Split in the files the JSON have -> trying to validate.
But what i want to pass as a parameter is the same XML, not the "classpath:validation.xsd".
return IntegrationFlows.from(configurationInbound(factory))
.split(Configuration.class,m->m.getFiles().values())
.filter(new XmlValidatingMessageSelector(commonResources.getResource("classpath:validation.xsd"),
SchemaType.XML_SCHEMA))
Is any way to do it?
Your explanation is a bit not clear, but let me guess:
You want to use an XSD resource from the message passing through the flow, not statically configured on the mentioned XmlValidatingMessageSelector.
If it is that, then unfortunately that is how this XmlValidatingMessageSelector is designed.
As a solution I suggest to implement your own DynaicXmlValidatingMessageSelector with some copied logic from the existing XmlValidatingMessageSelector and create an XmlValidator in the accept() method on the fly based on the incoming message.
I am using the IBM Social Business Toolkit. I have defined a connection for my Notes app via endpoints in the faces-config xml file. I wonder how I can access this file pro grammatically since I could not find a service that returns me the base url of IBM Connections.
It's useful to remember that an endpoint definition is really just creating a managed bean. The managed bean has a variable name you refer to it - the managed-bean-name property. You can access this directly from SSJS or via ExtLibUtil.resolveVariable() in Java. The definition also tells you the Java class that's being used, e.g. com.ibm.sbt.services.endpoints.ConnectionsBasicEndpoint. That really gives you all the information you need to get or set the properties.
So from SSJS you can just cast it to the class name, e.g.
var myService:com.ibm.sbt.services.endpoints.ConnectionsBasicEndpoint = connections
So the bit after the colon will be the managed-bean-class value and the bit after the equals sign will be the managed-bean-name. In Java, you can use
ConnectionsBasicEndpoint myService = (ConnectionsBasicEndpoint) ExtLibUtil.resolveVariable(ExtLibUtil.getXspContext().getFacesContext(), "connections");
You'll then have access to all the methods of the class, so you should be able to retrieve what you need.
The properties are part of the Java class, who are referred to in the Faces-Config.xml. So get the class by his fully qualified name or by bean name and set or get the properties
I think the best route will most likely be what Paul is suggesting: resolve the variable by its name and use the getters to get the effective properties that way.
Sven's suggestion is a good one to keep in mind for other situations. By accessing the faces-config.xml file as a resource, you could load it into an XML parser and find the values using XPath. I'm doing much that sort of technique in the next version of the OpenNTF Domino API, which will have a set of methods for manipulating the Faces config. However, one key aspect there is that reading the XML file directly will just get you the string values, which may be EL expressions, whereas going the resolveVariable route will get you the real current properties.
Is this possible?
<bean id="camelCustomComponent" class="x.y.z.CustomComponent" />
Below is the camel route
<to uri="camelCustomComponent:someThing?SomeParams=someValues" />
This is to leverage the camel component user/developer to use their name whatever they want.
I understand their should be a file with name camelCustomComponent which will have the Custom Component's class name.
Can we make dynamic.
Is it possible to initialise the component dynamically?
Thanks.
Regards
Senthil Kumar Sekar
I see two options.
Create a full component as per the Writing Components guide, the important point being that you will need to create a file under META-INF/services for your camelCustomComponent: URI to be detect by Camel.
Use the Bean Component which has some support for setting method parameter values. See the section titled Parameter binding using method option
Yes as bgossit posted, see the documentation about writing a component
http://camel.apache.org/writing-components.html
And the options in the uris, are just getter/setter in the endpoint class. That is all you need to do.
You can for example copy an existing component and use that for creating your own, for example if the component is similar to yours.
But better yet, maybe use the maven archetype to create a new component as documented here
http://camel.apache.org/camel-maven-archetypes.html
I need validate multiple fields in the JavaScript Framework, but can't figure out how.
What kind of validation do you need?
Client side: you must use a Javascript validation framework. For example, this one is a good validation framework using jQuery.
Server side: you just need to use <f:validateXXX/> components. For exmaple, <f:validateLength minimum="2" maximum="8"/> will check that the field contains a value that has a size between 2 and 8 characters. Otherwise, it will throw an Exception. Note that there a few validator by default, and you will not be able to validate an email address, or something like that. However, it is really easy to develop your own validator...
Server side, using Ajax. This is almost the same thing as the previous type of validation, except that the validation is ajaxified, which means that a request will be sent to the server once the user fills a field, and then validate the field. This is usefull to check on the fly the value. The component library Richfaces offers such features.
JSF has validation framework that can be used for simple validations. Like mandatory, length, format etc.
In addition it allows you to write custom validators which are invoked for field validations once configured in myfaces file.
Also a bunch of fields can be grouped into "SubForms" which will let you validate several fields in a go. A seamless validation without page being submitted would require Ajax integration. (Richfaces is a good option)