Scripting in ConnectPlaza
Why scripting in ConnectPlaza?
Using scripts, you can develop more rapidly.
Which components can we use
Scripting can be added to several different components. For example:
- Header enricher
- Generic consumer / Producer
- Message enricher
- Aggregator strategies
These components have the option of scripting. Like the Filter Strategy in the filter component or the Router Strategy Bean or Script Reference in the router producer.
What do I need to know
First of all you need to know the following:
- The script will be executed as part of the component
- The script will have direct access to ConnectMessages and Properties
- The script will have direct access to the log of the interface
- The script will be able to access all Java classes the agent uses
As you write a script, you have to think about the return type. This return type is defined per component, i.e.:
- Generic Message expects a ConnectMessage object or a ConnectMessagePart object
- A Header enricher returns an object which will become a header value
- A Filter will return a boolean
- A Router will return a Mapping key or ChannelName
Create a new script with the Scripts option at your business connector. The next screen will open:
Write your script and save it. The script will be added to the scripts list.
Using the scripts
There are a number of components, as described above, where you can use scripts. You can only use scripts available in the selection box. This can also be Java Beans or other resources. The system knows which resources to put into your selection box.
What can you do with scripting? What are the possibilities? Because you get access to all Java classes within the ConnectAgent and you get access to the message itself, the possibilities are endless. For instance, you can influence the ConnectMessage. You can transform, modify or delete parts. You can influence properties, add or modify dynamic headers based on part content. You can create dynamic filter and router strategies.
As you can see, you can do a lot of things with scripting, which could, in the past, only be done by using User defined services created by Java developers. Now you can add them yourself with scripting.
You can find the documentation for scripting in the JAVADOC documentation via the URL: https://www.connectplaza.com/doc/java/