GVExample TestProperty
Description
TestProperty service shows the use of the various metadata. This example is limited to create some properties and set its value with the scope of illustrating how metadata can be used. But shows also how to construct the possible properties that you will need in more complex flows.
For more information about metadata (or placeholders) click here.
VulCon Configuration
The preferred mode for creating a Service (at least its skeleton) is through the Service Wizard. Before using it you must first define a new Group, System and Channel, if you do not want to use those already present, and then start the Wizard.
From the core view:
- Right click the element Groups -> Insert after (or Insert before) -> Group. A new element Group will be created.
- Click on the Group new element and set the attribute id-group from the Properties View. We named it TEST_GROUP.
- Expand the GVSystems item.
- Right clicking on Systems, insert-after -> System. A new element System will be created.
- Set the System parameters in the Properties panel. We named it GVESB_TEST
- You can insert a new Channel right clicking the new System element -> Insert after (or Insert before) -> Channel*. A new Channel element will be created
- Click on this new Channel element and set the property id_channel. We named it TEST_CHANNEL.
Create a new service:
- From the Core View of VulCon, right click the element Services -> Insert After (Insert Before) -> Service*
- Set the Service properties: id-service as TestProperty, and group-name as TEST_GROUP.
- Add into the Service TestProperty just created a new Operation: right click the element Service -> Insert After -> Operation*
- Set the Operation property name as Request
Now, you are able to configure your flow from the Editor view as seen in the picture. To do that right click the Operation element -> Open editor.
Expand the Palette if it is not already visible from the Editor View. This can be done by clicking into a little arrow head present into the Editor right top corner. The steps are:
- Add a ChangeGVBuffer Node:
- From the Palette drag and drop into the editor a ChangeGVBuffer Node. A new windows will be open where you can set the element id. In this example we set
- id: test_property
- input: data
- From the Palette drag and drop into the editor an EndNode Node. A new windows will be open where you can set the element id. In this example we set
- id: end
- Create the connections:
- From the Palette click into the Default Connection (black arrow)
- Create a connection between the Star Node and test_property ChangeGVBuffer Node. This is done by clicking first the Start Node and then the test_property node.
- Create another Default Connection between test_property ChangeGVBuffer Node and end node.
- Save the Editor in the Eclipse Main Menu and close it. You can reopen it from the Core View by right clicking the respective element Operation.
The flow is already created. Refresh the Core view in the apposite icon. Check from that the workflow elements will be configured as follow:
Service: group-name="TEST_GROUP", id-service="TestProperty", service-activation="on", statistics="off" Operation: name="Request", operation-activation="on" Participant: id-channel="TEST_CHANNEL", id-system="GVESB_TEST" The following table shows the parameters to be defined for nodes and sub-elements added:
Node | Attribute |
---|---|
ChangeGVBufferNode | id="set_properties" input="input" next-node-id="return_status" output="output" |
ChangeGVBufferNode/ChangeGVBuffer | clear-data="false" |
ChangeGVBufferNode/ChangeGVBuffer/PropertyDef | name="SQL" value="sql{{ds.gv_test::select 'OK' from dual}}" |
GVEndNode | id="return_status" output="output" |
We added more properties in order to illustrate some GreenVulcano® ESB Placeholders. You can add more PropertyDef elements by right clicking the ChangeGVBuffer element present in the ChangeGVBufferNode -> Insert After -> PropertyDef. The defined properties are:
PropertyDef name | value |
---|---|
SQL | sql{{ds.gv_test::select 'OK' from dual}} |
SQLLIST | [sqllist{{ds.gv_test::select name from city order by 1}}] |
TIMESTAMP | timestamp{{yyyyMMdd HH:mm:ss}} |
OGNL | Service: ognl{{#object.getService()}} |
JAVASCRIPT | System: js{{gvesb::object.getSystem()}} |
SYSTEM | Server Name: ${{jboss.server.name}} |
CLASS | %{{fqclass}} |
DECODE | decode{{ognl{{#object.getProperty('SQL')}}::OK::Sql OK::Sql KO}} |
MINUTE | Minute decode{{js{{gvesb::timestamp{{mm}} % 2 == 0}}::true::EVEN::ODD}} |
Before finishing you must control that the VulCon Configuration has not errors. Errors are indicated by a red cross into the element icon.
- Review all the properties just configured
- Save your changes using the Save icon present in the Core View.
Once the flow is correctly configured, you can export the configuration and pass it to the GreenVulcano® ESB import tool, in order to add into GreenVulcano® ESB the service just created.
- The Export function is available in the view "Project". Expand your project
- Before you proceed, press F5 to refresh the file list.
- Right click the conf folder. It will open a drop-down list.
- Export your project as a compressed file.
Testing with GV Console
It is finally the time to test your project. To do that execute the following steps:
To deploy the new Service follow this steps:
- Start GreenVulcano® ESB
- Access to the GV Console.
- In the Deploy New Service section click Browse and select the file where you saved the VulCon configuration.
- Click Submit.
The section Deploy Services will be open. In this section you can select the services you want to deploy.
- Clicking on service TestProperty a new view will be showed containing the file GVCore.xml present in local and on server side.
- Click Deploy. Now you can save the document and write some notes about it.
- Save the Document. By saving you will return to the Deploy Service section.
Now pass to the GV Console section Utility.
- Click on Reload configuration
- Select GVCore.xml and then Reload. A new windows will be open to confirm the operation
- Click OK.
Go to the GV Console section Testing. In this section you can finally test your new service:
- Into the Service field select TestProperty
- Into the System field select GVESB_TEST (Optional)
- Click Request
When the service completes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. Standard fields and the detailed GVBuffer are described in the Output File Name (the default location is $GV_HOME/log/TestOutput.txt).
In case of error or exceptions you can review the logs file present in the folder $GV_HOME/log/.