Difference between revisions of "GVExample TOUPPER A"
(→Configuring a queue in JBoss) |
(→Defining Workflow Operations) |
||
(20 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
==Description== | ==Description== | ||
− | This simple example shows how to configure an asynchronous service with Forward JMS | + | This simple example shows how to configure an asynchronous service with a [[GVForwards|JMS Forward]] . |
+ | The Service TOUPPER_A is composed of three workflows that define the Client/ESB/Server interaction: | ||
+ | # the Client invokes the ''Request'' workflow to enqueue the input data into a request queue | ||
+ | # the [[GVForwards|JMS Forward]] (a {{GVESB}} component), listening on the request queue, extracts the JMS message and invokes the ''FWD_TOUPPER_A'' workflow that converts the payload to uppercase (simulate a Server invocation) then enqueues the new payload into a response queue | ||
+ | # the Client invokes the ''getReply'' workflow to dequeue the output data from a response queue | ||
==How To== | ==How To== | ||
− | The | + | The preferred mode for creating a Service (at least its skeleton) is through the Service Wizard. Before using it you must first configure the JMS Queue and the VCL plugins to interact with the JMS queue and execute the uppercase conversion. So let's define a new Group, System and Channel, if you do not want to use those already present, and then start the Wizard. |
− | === | + | ===Configuring JMS queues in JBoss=== |
− | + | The JMS queues are configured in JBoss by an XML file, ''gvesb-mq-destinations-service.xml'' present in <nowiki>$GV_HOME</nowiki>/application/deploy. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | The queues are configured in JBoss by | ||
A queue has: | A queue has: | ||
* A name that serves to identify it to JBoss. | * A name that serves to identify it to JBoss. | ||
− | * A JNDI Name | + | * A JNDI Name used by a client to connect to the queue. |
− | * | + | * MaxDeliveryAttempts (optional), to indicate how many times a message is put back into the queue for processing if the application does not confirm its reading. |
− | * RedeliveryDelay (optional), to indicate the | + | * RedeliveryDelay (optional), to indicate the delay (in ms) after a message will be put back into the queue if the application does not confirm its reading. |
− | The JndiName can be | + | The JndiName can be checked using the JBoss's jmx-console to find the MBean "service=JNDIView". |
− | In this example we use | + | In this example we use 2 queues: |
+ | * ''TOUPPER_A_Request_Queue'' | ||
+ | * ''TOUPPER_A_Response_Queue'' | ||
+ | |||
+ | To configure both queues go to the configuration file and insert the following MBean definitions: | ||
<syntaxhighlight lang="XML"> | <syntaxhighlight lang="XML"> | ||
<mbean code="org.jboss.jms.server.destination.QueueService" | <mbean code="org.jboss.jms.server.destination.QueueService" | ||
Line 51: | Line 48: | ||
</mbean> | </mbean> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | ===Defining Group, System and Channel=== | ||
+ | |||
+ | 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 DEFAULT_GRP | ||
+ | # Expand the GVSystems item. | ||
+ | # Right clicking on Systems, insert-after -> System. A new element System will be created. | ||
+ | # Set the [[System]] parameters in the [[VulCon_perspective|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_A | ||
+ | |||
===Defining Workflow Operations=== | ===Defining Workflow Operations=== | ||
Line 59: | Line 68: | ||
! Plugin !! Value | ! Plugin !! Value | ||
|- | |- | ||
− | | [[jms-enqueue]] || connection-factory="java:/XAConnectionFactory"<br/>destination-name="gvesb/jms/queue/TOUPPER_A_Request_Queue"<br/>name="JMSEnqueueTo::TOUPPER_A_Req"<br/> ref-dp="WriteString_JMSBytesMessageDataProvider | + | | [[jms-enqueue]] || connection-factory="java:/XAConnectionFactory"<br/>delivery-mode="persistent"<br/>destination-name="gvesb/jms/queue/TOUPPER_A_Request_Queue"<br/>name="JMSEnqueueTo::TOUPPER_A_Req"<br/> ref-dp="WriteString_JMSBytesMessageDataProvider" |
− | |||
− | |||
|- | |- | ||
− | | [[jms-enqueue]] || | + | | [[jms-enqueue]]/[[XAHelper]] || auto-enlist="false"<br/>transaction-status="TMSUCCESS"<br/>(You can find XAHelper section by adding it on the queue) |
− | |||
− | |||
|- | |- | ||
− | | [[jms- | + | | [[jms-enqueue]] || connection-factory="java:/XAConnectionFactory"<br/>delivery-mode="persistent"<br/>destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue"<br/>name="JMSEnqueueTo::TOUPPER_A_Resp"<br/> ref-dp="WriteString_JMSBytesMessageDataProvider" |
− | |||
− | |||
|- | |- | ||
− | | [[test-service-call]] || name="toupper_call" | + | | [[jms-enqueue]]/[[XAHelper]] || auto-enlist="false"<br/>transaction-status="TMSUCCESS" |
+ | |- | ||
+ | | [[jms-dequeue]] || connection-factory="java:/XAConnectionFactory"<br/>destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue"<br/>name="JMSDequeueTo::TOUPPER_A_Resp"<br/> ref-dp="ReadString_JMSBytesMessageDataProvider"<br/> receive-type="timeout" | ||
+ | |- | ||
+ | | [[jms-dequeue]]/[[XAHelper]] || auto-enlist="false"<br/>transaction-status="TMSUCCESS" | ||
+ | |- | ||
+ | | [[test-service-call]] || name="toupper_call" service="toupper" | ||
|} | |} | ||
− | Check that [[Data provider|Data Providers]] ''WriteString_JMSBytesMessageDataProvider'' and ''ReadString_JMSBytesMessageDataProvider'' | + | The ''WriteString_JMSBytesMessageDataProvider'' creates a JMS BytesMessage and write in its body the expected input java.lang.String converted to byte[].<br/> |
+ | The ''ReadString_JMSBytesMessageDataProvider'' extract the input JMS BytesMessage body as byte[] and convert it into a java.lang.String.<br/> | ||
+ | Check that [[Data provider|Data Providers]] ''WriteString_JMSBytesMessageDataProvider'' and ''ReadString_JMSBytesMessageDataProvider'' are present in the element DataProviders (JMSBytesMessageDataProvider and StringDataProvider respectively), visualized from the {{VULCON}} Adapter view. If don't, you can add it setting their attributes as seen in the following table: | ||
{|class="gvtable" | {|class="gvtable" | ||
! Data Provider !! Value | ! Data Provider !! Value | ||
|- | |- | ||
− | | [[Data provider|JMSBytesMessageDataProvider]] || name="WriteString_JMSBytesMessageDataProvider" | + | | [[Data provider|JMSBytesMessageDataProvider]] || name="WriteString_JMSBytesMessageDataProvider" |
− | + | |- | |
− | + | | [[Data provider|JMSBytesMessageDataProvider]]/[[Field]] || direction="OUT"<br/>key="output"<br/>type="field" | |
− | + | |- | |
+ | | [[Data provider|JMSBytesMessageDataProvider]]/Expression || type="ognl"<br/>writeBytes(#input.object.getBytes('UTF-8')) | ||
|- | |- | ||
− | | [[Data provider|StringDataProvider]] || name="ReadString_JMSBytesMessageDataProvider" | + | | [[Data provider|StringDataProvider]] || name="ReadString_JMSBytesMessageDataProvider" |
− | + | |- | |
− | + | | [[Data provider|StringDataProvider]]/[[Field]] || direction="INOUT"<br/>key="buffer"<br/>type="field" | |
− | + | |- | |
+ | | [[Data provider|StringDataProvider]]/Expression || type="ognl"<br/>#bArr = new byte[object.getBodyLength()], object.reset(), object.readBytes(#bArr), new java.lang.String(#bArr, 'UTF-8') | ||
|} | |} | ||
[[File:NewServiceWizard.jpg|thumb|New {{GVESB}} Service Wizard]]Now we are able to use the Wizard. | [[File:NewServiceWizard.jpg|thumb|New {{GVESB}} Service Wizard]]Now we are able to use the Wizard. | ||
# From the Core View of {{VULCON}}. Right click the element Services -> Wizard New Service | # From the Core View of {{VULCON}}. Right click the element Services -> Wizard New Service | ||
− | # A new windows will be open where you can set the name of the Service you want to create, in this case we named TOUPPER_A, and your Group, we used DEFAULT_GRP. You can also select the paradigm, for this example will be [[Paradigms_of_communication#asynchronous- | + | # A new windows will be open where you can set the name of the Service you want to create, in this case we named TOUPPER_A, and your Group, we used DEFAULT_GRP. You can also select the paradigm, for this example will be [[Paradigms_of_communication#asynchronous-synchronous|asynchronous-synchronous]]. Click next. |
# Set System as GVESB_TEST and Channel as TEST_CHANNEL_A. Then chose as Request Operation ''JMSEnqueueTo::TOUPPER_A_Req'', and the response Operation ''toupper_call''. Then finish. | # Set System as GVESB_TEST and Channel as TEST_CHANNEL_A. Then chose as Request Operation ''JMSEnqueueTo::TOUPPER_A_Req'', and the response Operation ''toupper_call''. Then finish. | ||
− | [[File:GVExamplesTOUPPER_AEditor.jpg |thumb |TOUPPER_A flow]]As you can see from the core view, inside the Services element, a new Service named TOUPPER_A has been created. This service contains | + | [[File:GVExamplesTOUPPER_AEditor.jpg |thumb |TOUPPER_A flow]]As you can see from the core view, inside the Services element, a new Service named TOUPPER_A has been created.<br/>This service contains three Operations (Workflows) |
We setted the first one as a Request (to enqueue), and the second as a GetReply (to dequeue). | We setted the first one as a Request (to enqueue), and the second as a GetReply (to dequeue). | ||
Nodes will be setted as seen in the following table: | Nodes will be setted as seen in the following table: | ||
Line 101: | Line 114: | ||
! Node !! Request !! GetReply | ! Node !! Request !! GetReply | ||
|- | |- | ||
− | | GVOperationNode || output | + | | [[GVOperationNode]] || output="output_JMSEnqueueTo::TOUPPER_A_Req"<br/>id="request"<br/>id-system="GVESB_TEST"<br/>input="input_JMSEnqueueTo::TOUPPER_A_Req"<br/>next-node-id="check_status" op-type="enqueue"<br/>operation-name="JMSEnqueueTo::TOUPPER_A_Req" || output="output_JMSDequeueTo::TOUPPER_A_Resp"<br/>id="request"<br/>id-system="GVESB_TEST"<br/>input="input_JMSDequeueTo::TOUPPER_A_Resp"<br/>next-node-id="check_status" op-type="dequeue"<br/>operation-name="JMSDequeueTo::TOUPPER_A_Resp"<br/>[[Op-type#DequeueFilter|DequeueFilter]]: |
+ | : [[Op-type#IDFilter|IDFilter]] | ||
+ | :: enabled="yes" use-input="yes" | ||
|- | |- | ||
− | | GVNodeCheck || default-id="return_status"<br/>id="check_status"<br/>input="output_JMSEnqueueTo::TOUPPER_A_Req"<br/>on-exception-id="return_error" <br/>op-type="check" || default-id="return_status"<br/>id="check_status"<br/>input=" | + | | [[GVNodeCheck]] || default-id="return_status"<br/>id="check_status"<br/>input="output_JMSEnqueueTo::TOUPPER_A_Req"<br/>on-exception-id="return_error"<br/>op-type="check" || default-id="return_status"<br/>id="check_status"<br/>input="output_JMSDequeueTo::TOUPPER_A_Resp"<br/>on-exception-id="return_error"<br/>op-type="check" |
− | on-exception-id="return_error" <br/>op-type="check" | ||
|- | |- | ||
− | | GVEndNode || id="return_status" <br/>op-type="end"<br/>output="output_JMSEnqueueTo::TOUPPER_A_Req" || id="return_status" <br/> | + | | [[GVEndNode]] || id="return_status"<br/>op-type="end"<br/>output="output_JMSEnqueueTo::TOUPPER_A_Req" || id="return_status"<br/>op-type="end"<br/>output="output_JMSDequeueTo::TOUPPER_A_Resp" |
− | op-type="end"<br/>output=" | ||
|- | |- | ||
− | | GVEndNode || id="return_error" <br/>output="output_JMSEnqueueTo::TOUPPER_A_Req" || id="return_error" <br/>output=" | + | | [[GVEndNode]] || id="return_error"<br/>output="output_JMSEnqueueTo::TOUPPER_A_Req" || id="return_error"<br/>output="output_JMSDequeueTo::TOUPPER_A_Resp" |
|} | |} | ||
+ | Operation FWD_TOUPPER_A will be configured as follow: | ||
+ | Attributes: name="Forward" operation-activation="on" out-check-type="none" | ||
+ | {|class="gvtable" | ||
+ | ! Nodes/Subelements !! Attributes | ||
+ | |- | ||
+ | | [[GVOperationNode]] || id-system="GVESB_TEST"<br/> input="input"<br/> next-node-id="enqueue_response" op-type="call"<br/> operation-name="toupper_call" output="output" | ||
+ | |- | ||
+ | | [[GVOperationNode]] || id="enqueue_response" id-system="GVESB_TEST"<br/> input="output" next-node-id="end"<br/> op-type="enqueue"<br/> operation-name="JMSEnqueueTo::TOUPPER_A_Resp"<br/> output="output" | ||
+ | |- | ||
+ | | [[GVEndNode]] || end-business-process="no" id="end" op-type="end"<br/> output="output" <br/> ChangeGVBuffer: clear-data="true" | ||
+ | |} | ||
The GVCore.xml configuration file will be changed as follow: | The GVCore.xml configuration file will be changed as follow: | ||
+ | * Into ''GVForwards'' element will be added the tag | ||
+ | <syntaxhighlight lang="XML"> | ||
+ | <ForwardConfiguration dump-message="true" enabled="true" | ||
+ | forwardName="FWD_TOUPPER_A" name="ToupperA" | ||
+ | ref-dp="ReadString_JMSBytesMessageDataProvider"> | ||
+ | <ForwardDeployment connection-factory="java:/XAConnectionFactory" | ||
+ | destination="gvesb/jms/queue/TOUPPER_A_Request_Queue" | ||
+ | destination-type="queue" reconnect-interval-sec="10" | ||
+ | transacted="true" transaction-timeout-sec="30"> | ||
+ | <XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/> | ||
+ | </ForwardDeployment> | ||
+ | </ForwardConfiguration> | ||
+ | </syntaxhighlight> | ||
* Into ''Services'' element will be added the tag | * Into ''Services'' element will be added the tag | ||
<syntaxhighlight lang="XML"> | <syntaxhighlight lang="XML"> | ||
<Service group-name="DEFAULT_GRP" id-service="TOUPPER_A" | <Service group-name="DEFAULT_GRP" id-service="TOUPPER_A" | ||
− | + | service-activation="on" statistics="off"> | |
<Operation name="Request" operation-activation="on" | <Operation name="Request" operation-activation="on" | ||
− | + | out-check-type="sys-svc-id" type="operation"> | |
<Description>VulCon generated Operation</Description> | <Description>VulCon generated Operation</Description> | ||
<Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/> | <Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/> | ||
<Flow first-node="request" point-x="50" point-y="150"> | <Flow first-node="request" point-x="50" point-y="150"> | ||
<GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode" | <GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode" | ||
− | + | id="request" id-system="GVESB_TEST" | |
− | + | input="input_JMSEnqueueTo::TOUPPER_A_Req" | |
− | + | next-node-id="check_status" op-type="enqueue" | |
− | + | operation-name="JMSEnqueueTo::TOUPPER_A_Req" | |
− | + | output="output_JMSEnqueueTo::TOUPPER_A_Req" | |
− | + | point-x="200" point-y="150" type="flow-node"/> | |
<GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck" | <GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck" | ||
− | + | default-id="return_status" id="check_status" | |
− | + | input="output_JMSEnqueueTo::TOUPPER_A_Req" | |
− | + | on-exception-id="return_error" op-type="check" | |
− | + | point-x="350" point-y="150" type="flow-node"/> | |
− | + | <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode" | |
− | + | id="return_status" op-type="end" | |
− | + | output="output_JMSEnqueueTo::TOUPPER_A_Req" | |
− | + | point-x="700" point-y="150" type="flow-node"/> | |
− | + | <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode" | |
− | + | id="return_error" op-type="end" | |
− | + | output="output_JMSEnqueueTo::TOUPPER_A_Req" | |
− | + | point-x="350" point-y="300" type="flow-node"/> | |
</Flow> | </Flow> | ||
</Operation> | </Operation> | ||
<Operation name="GetReply" operation-activation="on" | <Operation name="GetReply" operation-activation="on" | ||
− | + | out-check-type="sys-svc-id" type="operation"> | |
<Description>VulCon generated Operation</Description> | <Description>VulCon generated Operation</Description> | ||
<Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/> | <Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/> | ||
<Flow first-node="request" point-x="50" point-y="150"> | <Flow first-node="request" point-x="50" point-y="150"> | ||
<GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode" | <GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode" | ||
− | + | id="request" id-system="GVESB_TEST" | |
− | + | input="input_JMSDequeueTo::TOUPPER_A_Resp" | |
− | + | next-node-id="check_status" op-type="dequeue" | |
− | + | operation-name="JMSDequeueTo::TOUPPER_A_Resp" | |
− | + | output="output_JMSDequeueTo::TOUPPER_A_Resp" | |
− | + | point-x="200" point-y="150" type="flow-node"> | |
+ | <DequeueFilter> | ||
+ | <IDFilter enabled="yes" name="IDFilter" type="filter" | ||
+ | use-input="yes"/> | ||
+ | </DequeueFilter> | ||
+ | </GVOperationNode> | ||
<GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck" | <GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck" | ||
− | + | default-id="return_status" id="check_status" | |
− | + | input="output_JMSDequeueTo::TOUPPER_A_Resp" | |
− | + | on-exception-id="return_error" op-type="check" | |
− | + | point-x="350" point-y="150" type="flow-node"/> | |
<GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode" | <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode" | ||
− | + | id="return_status" op-type="end" | |
− | + | output="output_JMSDequeueTo::TOUPPER_A_Resp" | |
+ | point-x="700" point-y="150" type="flow-node"/> | ||
<GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode" | <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode" | ||
− | + | id="return_error" op-type="end" | |
− | + | output="output_JMSDequeueTo::TOUPPER_A_Resp" | |
+ | point-x="350" point-y="300" type="flow-node"/> | ||
+ | </Flow> | ||
+ | </Operation> | ||
+ | <Operation forward-name="FWD_TOUPPER_A" name="Forward" | ||
+ | operation-activation="on" out-check-type="none" | ||
+ | type="operation"> | ||
+ | <Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/> | ||
+ | <Flow first-node="call_server" point-x="20" point-y="150"> | ||
+ | <GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode" | ||
+ | id="call_server" id-system="GVESB_TEST" input="input" | ||
+ | next-node-id="enqueue_response" op-type="call" | ||
+ | operation-name="toupper_call" output="output" | ||
+ | point-x="147" point-y="148" type="flow-node"/> | ||
+ | <GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode" | ||
+ | id="enqueue_response" id-system="GVESB_TEST" | ||
+ | input="output" next-node-id="end" | ||
+ | op-type="enqueue" | ||
+ | operation-name="JMSEnqueueTo::TOUPPER_A_Resp" | ||
+ | output="output" point-x="319" point-y="152" | ||
+ | type="flow-node"/> | ||
+ | <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode" | ||
+ | end-business-process="no" id="end" op-type="end" | ||
+ | output="output" point-x="532" point-y="149" | ||
+ | type="flow-node"> | ||
+ | <ChangeGVBuffer clear-data="true"/> | ||
+ | </GVEndNode> | ||
</Flow> | </Flow> | ||
</Operation> | </Operation> | ||
Line 176: | Line 245: | ||
<Channel id-channel="TEST_CHANNEL_A"> | <Channel id-channel="TEST_CHANNEL_A"> | ||
<jms-enqueue acknowledge-type="auto-acknowledge" | <jms-enqueue acknowledge-type="auto-acknowledge" | ||
− | + | class="it.greenvulcano.gvesb.virtual.j2ee.JMSEnqueueOperation" | |
− | + | connection-factory="java:/XAConnectionFactory" | |
− | + | delivery-mode="persistent" | |
− | + | destination-name="gvesb/jms/queue/TOUPPER_A_Request_Queue" | |
− | + | destination-type="queue" | |
− | + | name="JMSEnqueueTo::TOUPPER_A_Req" priority="4" | |
− | + | ref-dp="WriteString_JMSBytesMessageDataProvider" | |
− | + | transacted="false" type="enqueue"> | |
<XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/> | <XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/> | ||
</jms-enqueue> | </jms-enqueue> | ||
<jms-enqueue acknowledge-type="auto-acknowledge" | <jms-enqueue acknowledge-type="auto-acknowledge" | ||
− | + | class="it.greenvulcano.gvesb.virtual.j2ee.JMSEnqueueOperation" | |
− | + | connection-factory="java:/XAConnectionFactory" | |
− | + | delivery-mode="persistent" | |
− | + | destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue" | |
− | + | destination-type="queue" | |
− | + | name="JMSEnqueueTo::TOUPPER_A_Resp" priority="4" | |
− | + | ref-dp="WriteString_JMSBytesMessageDataProvider" | |
+ | transacted="false" type="enqueue"> | ||
<XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/> | <XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/> | ||
</jms-enqueue> | </jms-enqueue> | ||
<jms-dequeue acknowledge-type="auto-acknowledge" | <jms-dequeue acknowledge-type="auto-acknowledge" | ||
− | + | class="it.greenvulcano.gvesb.virtual.j2ee.JMSDequeueOperation" | |
− | + | connection-factory="java:/XAConnectionFactory" | |
− | + | destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue" | |
− | + | destination-type="queue" | |
− | + | name="JMSDequeueTo::TOUPPER_A_Resp" | |
− | + | receive-timeout-overridable="false" | |
− | + | receive-type="timeout" | |
− | + | ref-dp="ReadString_JMSBytesMessageDataProvider" | |
+ | transacted="false" type="dequeue"> | ||
+ | <XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/> | ||
</jms-dequeue> | </jms-dequeue> | ||
<test-service-call class="it.greenvulcano.gvesb.virtual.internal.TestServiceCall" | <test-service-call class="it.greenvulcano.gvesb.virtual.internal.TestServiceCall" | ||
− | + | name="toupper_call" service="toupper" type="call"/> | |
</Channel> | </Channel> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 214: | Line 286: | ||
[[File:GVExamplesTOUPPER5.jpg|thumb|Exporting configuration]]Once the flow is correctly configured, the user can export the configuration and pass it to the {{GVESB}} import tool, in order to add into the {{GVESB}} the service just created. | [[File:GVExamplesTOUPPER5.jpg|thumb|Exporting configuration]]Once the flow is correctly configured, the user can export the configuration and pass it to the {{GVESB}} import tool, in order to add into the {{GVESB}} the service just created. | ||
+ | |||
# The Export function is available in the view "Project". Expand the project | # The Export function is available in the view "Project". Expand the project | ||
# Before you proceed press F5 to refresh the file list. | # Before you proceed press F5 to refresh the file list. | ||
# Right click the ''conf'' folder. It will open a drop-down list. | # Right click the ''conf'' folder. It will open a drop-down list. | ||
# Export your project as a compressed file. | # Export your project as a compressed file. | ||
− | |||
===Testing with {{GVCONSOLE}}=== | ===Testing with {{GVCONSOLE}}=== | ||
− | It is finally | + | It is finally the time to test your project. To do that execute the following steps: |
[[File:GVCONSOLEDeploy.jpg|thumb|Deploy new Service]]Suppose you have saved the {{VULCON}} project as <nowiki>"${{gv.app.home}}/TEST/REPG1.zip"</nowiki>. To deploy the new Service follow this steps: | [[File:GVCONSOLEDeploy.jpg|thumb|Deploy new Service]]Suppose you have saved the {{VULCON}} project as <nowiki>"${{gv.app.home}}/TEST/REPG1.zip"</nowiki>. To deploy the new Service follow this steps: | ||
Line 228: | Line 300: | ||
# [[GV_Console#Access|Access to the {{GVCONSOLE}}]]. | # [[GV_Console#Access|Access to the {{GVCONSOLE}}]]. | ||
# In the Deploy New Service section click Browse and select the file where you saved the {{VULCON}} configuration. | # In the Deploy New Service section click Browse and select the file where you saved the {{VULCON}} configuration. | ||
− | # | + | # Click Submit. |
The section [[Deploy_Service|Deploy Services]] will be open. In this section you can select the services you want to deploy. | The section [[Deploy_Service|Deploy Services]] will be open. In this section you can select the services you want to deploy. | ||
− | # | + | # Selecting the TOUPPER_A service a new view will be shown. In this view is the contents of the file GVCore.xml in the local version and the one on the server. |
# Click Deploy. Now you can save the document and write some notes about it. | # 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. | # Save the Document. By saving you will return to the [[Deploy Service]] section. | ||
Line 237: | Line 309: | ||
[[File:GVConsoleUtilityReload1.jpg|thumb|{{GVCONSOLE}} Utility section]]Now pass to the {{GVCONSOLE}} section [[Utility]]. | [[File:GVConsoleUtilityReload1.jpg|thumb|{{GVCONSOLE}} Utility section]]Now pass to the {{GVCONSOLE}} section [[Utility]]. | ||
# Click on [[Reload_Configuration|Reload configuration]] | # Click on [[Reload_Configuration|Reload configuration]] | ||
− | # Select GVCore.xml and then Reload. | + | # Select GVCore.xml and GVAdapter.xml, then Reload. |
− | + | # Finally confirm the operation. | |
+ | |||
+ | |||
+ | [[File:GVConsoleTesting.jpg|thumb|{{GVCONSOLE}} Testing section]]Go to the {{GVCONSOLE}} section [[Testing]]. In this section you can finally test your new service. Remember that Service TOUPPER_A is composed by three independent Operations: | ||
− | + | *'''Request''' | |
− | # Into the Service | + | # Into the Service field select TOUPPER_A |
− | # Into the System | + | # Into the System field select GVESB_TEST |
+ | # Into the Payload area insert the text to convert in uppercase | ||
# Click Request | # Click Request | ||
− | When test | + | *'''FWD_TOUPPER_A''', executed by {{GVESB}} [[GVForwards|JMS Forward]]. |
+ | |||
+ | *'''getReply''' | ||
+ | # Clear the Payload area | ||
+ | # Click getReply | ||
+ | |||
+ | When each test completes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. In this case no properties have been defined, thus only main informations about the process (System, Service, Id, etc.) are shown. To view the service payload output click on ''Show as Text'' button. Standard fields and the detailed GVBuffer are described in the [[Testing#Data_input|Output File Name]] (the default location is <nowiki>$GV_HOME</nowiki>/log/TestOutput.txt). | ||
− | In case of error or exceptions you can review the logs file | + | In case of error or exceptions you can review the logs file in the <nowiki>$GV_HOME</nowiki>/log/ folder. |
Latest revision as of 13:35, 29 May 2014
Contents
Description
This simple example shows how to configure an asynchronous service with a JMS Forward . The Service TOUPPER_A is composed of three workflows that define the Client/ESB/Server interaction:
- the Client invokes the Request workflow to enqueue the input data into a request queue
- the JMS Forward (a GreenVulcano® ESB component), listening on the request queue, extracts the JMS message and invokes the FWD_TOUPPER_A workflow that converts the payload to uppercase (simulate a Server invocation) then enqueues the new payload into a response queue
- the Client invokes the getReply workflow to dequeue the output data from a response queue
How To
The preferred mode for creating a Service (at least its skeleton) is through the Service Wizard. Before using it you must first configure the JMS Queue and the VCL plugins to interact with the JMS queue and execute the uppercase conversion. So let's define a new Group, System and Channel, if you do not want to use those already present, and then start the Wizard.
Configuring JMS queues in JBoss
The JMS queues are configured in JBoss by an XML file, gvesb-mq-destinations-service.xml present in $GV_HOME/application/deploy.
A queue has:
- A name that serves to identify it to JBoss.
- A JNDI Name used by a client to connect to the queue.
- MaxDeliveryAttempts (optional), to indicate how many times a message is put back into the queue for processing if the application does not confirm its reading.
- RedeliveryDelay (optional), to indicate the delay (in ms) after a message will be put back into the queue if the application does not confirm its reading.
The JndiName can be checked using the JBoss's jmx-console to find the MBean "service=JNDIView".
In this example we use 2 queues:
- TOUPPER_A_Request_Queue
- TOUPPER_A_Response_Queue
To configure both queues go to the configuration file and insert the following MBean definitions:
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=TOUPPER_A_Request_Queue"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="JNDIName">gvesb/jms/queue/TOUPPER_A_Request_Queue</attribute>
<attribute name="RedeliveryDelay">60000</attribute>
<attribute name="MaxDeliveryAttempts">100</attribute>
</mbean>
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=TOUPPER_A_Response_Queue"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="JNDIName">gvesb/jms/queue/TOUPPER_A_Response_Queue</attribute>
<attribute name="RedeliveryDelay">60000</attribute>
<attribute name="MaxDeliveryAttempts">100</attribute>
</mbean>
Defining Group, System and Channel
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 DEFAULT_GRP
- 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_A
Defining Workflow Operations
Once you have created the Channel, insert into the operations you need for the workflow. In this case:
Plugin | Value |
---|---|
jms-enqueue | connection-factory="java:/XAConnectionFactory" delivery-mode="persistent" destination-name="gvesb/jms/queue/TOUPPER_A_Request_Queue" name="JMSEnqueueTo::TOUPPER_A_Req" ref-dp="WriteString_JMSBytesMessageDataProvider" |
jms-enqueue/XAHelper | auto-enlist="false" transaction-status="TMSUCCESS" (You can find XAHelper section by adding it on the queue) |
jms-enqueue | connection-factory="java:/XAConnectionFactory" delivery-mode="persistent" destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue" name="JMSEnqueueTo::TOUPPER_A_Resp" ref-dp="WriteString_JMSBytesMessageDataProvider" |
jms-enqueue/XAHelper | auto-enlist="false" transaction-status="TMSUCCESS" |
jms-dequeue | connection-factory="java:/XAConnectionFactory" destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue" name="JMSDequeueTo::TOUPPER_A_Resp" ref-dp="ReadString_JMSBytesMessageDataProvider" receive-type="timeout" |
jms-dequeue/XAHelper | auto-enlist="false" transaction-status="TMSUCCESS" |
test-service-call | name="toupper_call" service="toupper" |
The WriteString_JMSBytesMessageDataProvider creates a JMS BytesMessage and write in its body the expected input java.lang.String converted to byte[].
The ReadString_JMSBytesMessageDataProvider extract the input JMS BytesMessage body as byte[] and convert it into a java.lang.String.
Check that Data Providers WriteString_JMSBytesMessageDataProvider and ReadString_JMSBytesMessageDataProvider are present in the element DataProviders (JMSBytesMessageDataProvider and StringDataProvider respectively), visualized from the VulCon Adapter view. If don't, you can add it setting their attributes as seen in the following table:
Data Provider | Value |
---|---|
JMSBytesMessageDataProvider | name="WriteString_JMSBytesMessageDataProvider" |
JMSBytesMessageDataProvider/Field | direction="OUT" key="output" type="field" |
JMSBytesMessageDataProvider/Expression | type="ognl" writeBytes(#input.object.getBytes('UTF-8')) |
StringDataProvider | name="ReadString_JMSBytesMessageDataProvider" |
StringDataProvider/Field | direction="INOUT" key="buffer" type="field" |
StringDataProvider/Expression | type="ognl" #bArr = new byte[object.getBodyLength()], object.reset(), object.readBytes(#bArr), new java.lang.String(#bArr, 'UTF-8') |
Now we are able to use the Wizard.
- From the Core View of VulCon. Right click the element Services -> Wizard New Service
- A new windows will be open where you can set the name of the Service you want to create, in this case we named TOUPPER_A, and your Group, we used DEFAULT_GRP. You can also select the paradigm, for this example will be asynchronous-synchronous. Click next.
- Set System as GVESB_TEST and Channel as TEST_CHANNEL_A. Then chose as Request Operation JMSEnqueueTo::TOUPPER_A_Req, and the response Operation toupper_call. Then finish.
As you can see from the core view, inside the Services element, a new Service named TOUPPER_A has been created.
This service contains three Operations (Workflows)
We setted the first one as a Request (to enqueue), and the second as a GetReply (to dequeue). Nodes will be setted as seen in the following table:
Node | Request | GetReply |
---|---|---|
GVOperationNode | output="output_JMSEnqueueTo::TOUPPER_A_Req" id="request" id-system="GVESB_TEST" input="input_JMSEnqueueTo::TOUPPER_A_Req" next-node-id="check_status" op-type="enqueue" operation-name="JMSEnqueueTo::TOUPPER_A_Req" |
output="output_JMSDequeueTo::TOUPPER_A_Resp" id="request" id-system="GVESB_TEST" input="input_JMSDequeueTo::TOUPPER_A_Resp" next-node-id="check_status" op-type="dequeue" operation-name="JMSDequeueTo::TOUPPER_A_Resp" DequeueFilter:
|
GVNodeCheck | default-id="return_status" id="check_status" input="output_JMSEnqueueTo::TOUPPER_A_Req" on-exception-id="return_error" op-type="check" |
default-id="return_status" id="check_status" input="output_JMSDequeueTo::TOUPPER_A_Resp" on-exception-id="return_error" op-type="check" |
GVEndNode | id="return_status" op-type="end" output="output_JMSEnqueueTo::TOUPPER_A_Req" |
id="return_status" op-type="end" output="output_JMSDequeueTo::TOUPPER_A_Resp" |
GVEndNode | id="return_error" output="output_JMSEnqueueTo::TOUPPER_A_Req" |
id="return_error" output="output_JMSDequeueTo::TOUPPER_A_Resp" |
Operation FWD_TOUPPER_A will be configured as follow: Attributes: name="Forward" operation-activation="on" out-check-type="none"
Nodes/Subelements | Attributes |
---|---|
GVOperationNode | id-system="GVESB_TEST" input="input" next-node-id="enqueue_response" op-type="call" operation-name="toupper_call" output="output" |
GVOperationNode | id="enqueue_response" id-system="GVESB_TEST" input="output" next-node-id="end" op-type="enqueue" operation-name="JMSEnqueueTo::TOUPPER_A_Resp" output="output" |
GVEndNode | end-business-process="no" id="end" op-type="end" output="output" ChangeGVBuffer: clear-data="true" |
The GVCore.xml configuration file will be changed as follow:
- Into GVForwards element will be added the tag
<ForwardConfiguration dump-message="true" enabled="true"
forwardName="FWD_TOUPPER_A" name="ToupperA"
ref-dp="ReadString_JMSBytesMessageDataProvider">
<ForwardDeployment connection-factory="java:/XAConnectionFactory"
destination="gvesb/jms/queue/TOUPPER_A_Request_Queue"
destination-type="queue" reconnect-interval-sec="10"
transacted="true" transaction-timeout-sec="30">
<XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/>
</ForwardDeployment>
</ForwardConfiguration>
- Into Services element will be added the tag
<Service group-name="DEFAULT_GRP" id-service="TOUPPER_A"
service-activation="on" statistics="off">
<Operation name="Request" operation-activation="on"
out-check-type="sys-svc-id" type="operation">
<Description>VulCon generated Operation</Description>
<Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/>
<Flow first-node="request" point-x="50" point-y="150">
<GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode"
id="request" id-system="GVESB_TEST"
input="input_JMSEnqueueTo::TOUPPER_A_Req"
next-node-id="check_status" op-type="enqueue"
operation-name="JMSEnqueueTo::TOUPPER_A_Req"
output="output_JMSEnqueueTo::TOUPPER_A_Req"
point-x="200" point-y="150" type="flow-node"/>
<GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck"
default-id="return_status" id="check_status"
input="output_JMSEnqueueTo::TOUPPER_A_Req"
on-exception-id="return_error" op-type="check"
point-x="350" point-y="150" type="flow-node"/>
<GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
id="return_status" op-type="end"
output="output_JMSEnqueueTo::TOUPPER_A_Req"
point-x="700" point-y="150" type="flow-node"/>
<GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
id="return_error" op-type="end"
output="output_JMSEnqueueTo::TOUPPER_A_Req"
point-x="350" point-y="300" type="flow-node"/>
</Flow>
</Operation>
<Operation name="GetReply" operation-activation="on"
out-check-type="sys-svc-id" type="operation">
<Description>VulCon generated Operation</Description>
<Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/>
<Flow first-node="request" point-x="50" point-y="150">
<GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode"
id="request" id-system="GVESB_TEST"
input="input_JMSDequeueTo::TOUPPER_A_Resp"
next-node-id="check_status" op-type="dequeue"
operation-name="JMSDequeueTo::TOUPPER_A_Resp"
output="output_JMSDequeueTo::TOUPPER_A_Resp"
point-x="200" point-y="150" type="flow-node">
<DequeueFilter>
<IDFilter enabled="yes" name="IDFilter" type="filter"
use-input="yes"/>
</DequeueFilter>
</GVOperationNode>
<GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck"
default-id="return_status" id="check_status"
input="output_JMSDequeueTo::TOUPPER_A_Resp"
on-exception-id="return_error" op-type="check"
point-x="350" point-y="150" type="flow-node"/>
<GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
id="return_status" op-type="end"
output="output_JMSDequeueTo::TOUPPER_A_Resp"
point-x="700" point-y="150" type="flow-node"/>
<GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
id="return_error" op-type="end"
output="output_JMSDequeueTo::TOUPPER_A_Resp"
point-x="350" point-y="300" type="flow-node"/>
</Flow>
</Operation>
<Operation forward-name="FWD_TOUPPER_A" name="Forward"
operation-activation="on" out-check-type="none"
type="operation">
<Participant id-channel="TEST_CHANNEL_A" id-system="GVESB_TEST"/>
<Flow first-node="call_server" point-x="20" point-y="150">
<GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode"
id="call_server" id-system="GVESB_TEST" input="input"
next-node-id="enqueue_response" op-type="call"
operation-name="toupper_call" output="output"
point-x="147" point-y="148" type="flow-node"/>
<GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode"
id="enqueue_response" id-system="GVESB_TEST"
input="output" next-node-id="end"
op-type="enqueue"
operation-name="JMSEnqueueTo::TOUPPER_A_Resp"
output="output" point-x="319" point-y="152"
type="flow-node"/>
<GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
end-business-process="no" id="end" op-type="end"
output="output" point-x="532" point-y="149"
type="flow-node">
<ChangeGVBuffer clear-data="true"/>
</GVEndNode>
</Flow>
</Operation>
</Service>
- Into System element will be added the tag
<Channel id-channel="TEST_CHANNEL_A">
<jms-enqueue acknowledge-type="auto-acknowledge"
class="it.greenvulcano.gvesb.virtual.j2ee.JMSEnqueueOperation"
connection-factory="java:/XAConnectionFactory"
delivery-mode="persistent"
destination-name="gvesb/jms/queue/TOUPPER_A_Request_Queue"
destination-type="queue"
name="JMSEnqueueTo::TOUPPER_A_Req" priority="4"
ref-dp="WriteString_JMSBytesMessageDataProvider"
transacted="false" type="enqueue">
<XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/>
</jms-enqueue>
<jms-enqueue acknowledge-type="auto-acknowledge"
class="it.greenvulcano.gvesb.virtual.j2ee.JMSEnqueueOperation"
connection-factory="java:/XAConnectionFactory"
delivery-mode="persistent"
destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue"
destination-type="queue"
name="JMSEnqueueTo::TOUPPER_A_Resp" priority="4"
ref-dp="WriteString_JMSBytesMessageDataProvider"
transacted="false" type="enqueue">
<XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/>
</jms-enqueue>
<jms-dequeue acknowledge-type="auto-acknowledge"
class="it.greenvulcano.gvesb.virtual.j2ee.JMSDequeueOperation"
connection-factory="java:/XAConnectionFactory"
destination-name="gvesb/jms/queue/TOUPPER_A_Response_Queue"
destination-type="queue"
name="JMSDequeueTo::TOUPPER_A_Resp"
receive-timeout-overridable="false"
receive-type="timeout"
ref-dp="ReadString_JMSBytesMessageDataProvider"
transacted="false" type="dequeue">
<XAHelper auto-enlist="false" transaction-status="TMSUCCESS"/>
</jms-dequeue>
<test-service-call class="it.greenvulcano.gvesb.virtual.internal.TestServiceCall"
name="toupper_call" service="toupper" type="call"/>
</Channel>
Now you are able to test your first VulCon service from the GV Console®. But first you need to export the configuration.
Once the flow is correctly configured, the user can export the configuration and pass it to the GreenVulcano® ESB import tool, in order to add into the GreenVulcano® ESB the service just created.
- The Export function is available in the view "Project". Expand the 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:
Suppose you have saved the VulCon project as "${{gv.app.home}}/TEST/REPG1.zip". 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.
- Selecting the TOUPPER_A service a new view will be shown. In this view is the contents of the file GVCore.xml in the local version and the one on the server.
- 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 GVAdapter.xml, then Reload.
- Finally confirm the operation.
Go to the GV Console section Testing. In this section you can finally test your new service. Remember that Service TOUPPER_A is composed by three independent Operations:
- Request
- Into the Service field select TOUPPER_A
- Into the System field select GVESB_TEST
- Into the Payload area insert the text to convert in uppercase
- Click Request
- FWD_TOUPPER_A, executed by GreenVulcano® ESB JMS Forward.
- getReply
- Clear the Payload area
- Click getReply
When each test completes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. In this case no properties have been defined, thus only main informations about the process (System, Service, Id, etc.) are shown. To view the service payload output click on Show as Text button. 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 in the $GV_HOME/log/ folder.