- Simple JMS
- Multi Threaded
- POJO (Plain Old Java Object)
Scripts
The scripts required for generation of these services are present in the following location:
Windows: %FIORANO_HOME%\esb\tools\templates\edbctemplates.bat
Linux: %FIORANO_HOME%/esb/tools/templates/edbctemplates.sh
Simple JMS
Generating Template
- Execute %FIORANO_HOME%\esb\tools\templates\templates-console.bat [sh]
- From the command prompt, launch the wizard using %FIORANO_HOME%/esb/tools/templates/edbctemplates.bat [sh]
Syntax:edbctemplates.bat [sh] –dest <dir>
<dir> - target directory where component code is generated.
Example: edbctemplates.bat –dest C:\SampleComponents\EDBC\SimpleJMS
- Provide service details in Service Information panel and click Next.
Figure 1: Details of service
- In Runtime Arguments panel, add required runtime arguments.
Figure 2: Adding runtime arguments
- In Template Information panel, select 'Simple JMS'.
Figure 3: Specifying template to use - Specify required number of input and output ports and click Finish.
Component Development
Adding Business Logic
Business logic should be added in onMessage(Message msg) method of ${ServiceGUID}MessageListener (in the above example SimpleJMSMessageListener) class
Accessing Runtime Arguments
Runtime arguments passed to the service can be accessed using runtimeArguments.getParameter("<runtime argument>")
Sending Messages on Output Port
Messages can be sent on required output port using producer.send((Destination) outputDestinations.get("<output port name>"), <message>);
Multi Threaded
Generating Template
- Execute %FIORANO_HOME%\esb\tools\templates\templates-console.bat [sh].
- From the command prompt launch the wizard using %FIORANO_HOME%\esb\tools\templates\edbctemplates.bat [sh].
Syntax:edbctemplates.bat [sh] –dest <dir>
<dir> - target directory where component code is generated
Example: edbctemplates.bat –dest C:\SampleComponents\EDBC\MultiThreaded
- Provide service details in Service Information panel and click Next.
Figure 4: Details of service
- In Runtime Arguments panel, add required runtime arguments.
Figure 5: Adding runtime arguments
- In Template Information panel, select MultiThreaded, specify required number of input and output ports and then click Finish.
Figure 6: Specifying template to use
Component Development
Adding Business Logic
Business logic should be added in execute() method of ${ServiceGUID}Job (in the above example MultiThreadedJob) class
Accessing Runtime Arguments
Runtime arguments passed to the service can be accessed using runtimeArguments.getParameter("<runtime argument>")
Sending Messages on Output Port
Messages can be sent on required output port using sender.send((<message>,"<output port name>");
POJO
Generating Template
- Execute %FIORANO_HOME%\esb\tools\templates\templates-console.bat [sh].
- From the command prompt launch the wizard using FIORANO_HOME%\esb\tools\templates\edbctemplates.bat [sh]
Syntax: edbctemplates.bat [sh] –dest <dir>
<dir> - target directory where component code is generated
Example: edbctemplates.bat –dest C:\SampleComponents\EDBC\POJO - Provide service details in Service Information panel and click Next.
Figure 7: Details of service
- In Runtime Arguments panel, add required runtime arguments.
Figure 8: Adding runtime arguments
- In Template Information panel, select POJO.
- Select jar file containing the required POJO class.
- Select the required method from list of methods shown.
Only methods with following signatures is shown:- public static void <method_name>(String)
- public static void <method_name>(Message)
- public static Message <method_name>(Message)
- public static Message <method_name>(String)
- public static String <method_name>(Message)
- public static String <method_name>(String)
Figure 9: Specifying template to use and selecting required method
Component generated for a POJO will contain one input-output pair for each method selected. However, if the return type is void, output port will not be generated for that method.
When a message arrives on an input port, associated method is invoked and response is sent to respective output port if present.
Component Development
Business logic is generated into component and can be used as it is.