Contents

Fiorano 10 provides EDBC templates which aid in component development. These templates provide lightweight services which do not have framework.

Three types of templates are supported for EDBC components:

  1. Simple JMS
  2. Multi Threaded
  3. 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

  1. Execute %FIORANO_HOME%\esb\tools\templates\templates-console.bat [sh]

  2. 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
     
  3. Provide service details in Service Information panel and click Next.


    Figure 1: Details of service
     
  4. In Runtime Arguments panel, add required runtime arguments.


    Figure 2: Adding runtime arguments
     
  5. In Template Information panel, select 'Simple JMS'.


    Figure 3: Specifying template to use

  6. 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

${ServiceGUID}MessageListener showing method where business logic should be added

Accessing Runtime Arguments

Runtime arguments passed to the service can be accessed using runtimeArguments.getParameter("<runtime argument>")

Accessing runtime arguments

Sending Messages on Output Port

Messages can be sent on required output port using producer.send((Destination) outputDestinations.get("<output port name>"), <message>);

Sending message on output port "OUT_PORT_1"

Multi Threaded

Generating Template

  1. Execute %FIORANO_HOME%\esb\tools\templates\templates-console.bat [sh].

  2. 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
     
  3. Provide service details in Service Information panel and click Next.


    Figure 4: Details of service
     
  4. In Runtime Arguments panel, add required runtime arguments.


    Figure 5: Adding runtime arguments
     
  5. 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

${ServiceGUID}job showing method where business logic should be added

Accessing Runtime Arguments

Runtime arguments passed to the service can be accessed using runtimeArguments.getParameter("<runtime argument>")

Accessing runtime arguments

Sending Messages on Output Port

Messages can be sent on required output port using sender.send((<message>,"<output port name>");

Sending message on output port "OUT_PORT_1"

 POJO

Generating Template

  1. Execute %FIORANO_HOME%\esb\tools\templates\templates-console.bat [sh].

  2. 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

  3. Provide service details in Service Information panel and click Next.


    Figure 7: Details of service
     
  4. In Runtime Arguments panel, add required runtime arguments.


    Figure 8: Adding runtime arguments
     
  5. In Template Information panel, select POJO.
  6. Select jar file containing the required POJO class.
  7. 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.

Adaptavist ThemeBuilder EngineAtlassian Confluence