Usage and real examples of Input Message options

admin's picture
Different options for Output Message determine priority of elements taken by a service, if it is element from Process Data or configuration parameter and the third option in which we tell to service to read only its configuration parameter and Process Data not at all.
 
Two options for Input Message only determine where the result will be written, into Process Data or Input Message.
 
Input Message is important to understand when you have 2 services in a BP where both of them produce the Primary Document as its result. That means, the second service will replace the Primary Document produced by the first service. After the second service executes, we have only one Primary Document, that is result of the second one. If we want to have both documents in Process Data, we have to place the Primary Document of the first service into Process Data under the name different than Primary Document and it will help us to retain the document in a business process.
 
Here is the example where we will show what happens when there are 2 different services where both produce Primary Document. The first service is FSA (File System Adapter) and another one is LWJDBC (Lightweight JDBC). In the end of a BP execution we can find only one Primary Document as the result of File System Adapter. Primary Document produced by LWJDBC is overwritten by the FSA:

Example 1 (Primary Document pulled from a DB by LWJDBC overriden by the document collected by FSA): 

<process name="default">

<sequence>

                   <operation name="Lightweight JDBC Adapter">
                             <participant name="LightweightJDBCAdapterQuery"/>
                             <output message="LightweightJDBCAdapterTypeInputMessage">
                                      <assign to="pool">mysqlPool</assign>
                                      <assign to="query_type">SELECT</assign>
                                      <assign to="result_name">result</assign>
                                      <assign to="row_name">row</assign>
                                      <assign to="sql">select * from SI_VERSION</assign>
                                      <assign to="." from="*"/>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
                   <operation name="File System Adapter">
                             <participant name="FSA_configurationName"/>
                             <output message="FileSystemInputMessage">
                                      <assign to="Action">FS_COLLECT</assign>
                                      <assign to="deleteAfterCollect">true</assign>
                                      <assign to="filter">fileNameFilter</assign>
                                      <assign to="." from="*"/>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
          </sequence>
</process>
 
To save a result of LWJDBC adapter in the Process Data under another name, we can use assign, to save the first document in a temp storage. You can see that in Example 2:

Example 2 (Primary Document saved under another element with separate assign statement): 

<process name="default">

          <sequence>
                   <operation name="Lightweight JDBC Adapter">
                             <participant name="LightweightJDBCAdapterQuery"/>
                             <output message="LightweightJDBCAdapterTypeInputMessage">
                                      <assign to="pool">mysqlPool</assign>
                                      <assign to="query_type">SELECT</assign>
                                      <assign to="result_name">result</assign>
                                      <assign to="row_name">row</assign>
                                      <assign to="sql">select * from SI_VERSION</assign>
                                      <assign to="." from="*"/>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
                  
                   <assign to="tempStorage" from="PrimaryDocument/@SCIObjectID"/>
                  
                   <operation name="File System Adapter">
                             <participant name="FSA_configurationName"/>
                             <output message="FileSystemInputMessage">
                                      <assign to="Action">FS_COLLECT</assign>
                                      <assign to="deleteAfterCollect">false</assign>
                                      <assign to="filter">fileNameFilter</assign>
                                      <assign to="." from="*"/>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
          </sequence>
</process>
 
In the end we can find 2 documents in the Process Data: 

<?xml version="1.0" encoding="UTF-8"?>

<ProcessData>
          <tempStorage SCIObjectID="serverName:49b61c40:11032a4d48e:5d0f"/>
          <FileName>fileName</FileName>
          <PrimaryDocument SCIObjectID="serverName:49b61c40:11032a4d48e:5d50"/>
</ProcessData>
 

If we want to avoid this additional step between LWJDBC Adapter and FSA for saving the result of LWJDBC into document named 'tempStorage', we can use assign in input message inside of LWJDBC. First of all, option for Input Message must be 'Allow message write' and additional assign must be added in input message (by Add option in GPM). You can see it in Example 3:

Example 3 (Primary Document saved under another element with assign statement inside of Input Message):

<process name="default">

          <sequence>
                   <operation name="Lightweight JDBC Adapter">
                             <participant name="LightweightJDBCAdapterQuery"/>
                             <output message="LightweightJDBCAdapterTypeInputMessage">
                                      <assign to="pool">mysqlPool</assign>
                                      <assign to="query_type">SELECT</assign>
                                      <assign to="result_name">result</assign>
                                      <assign to="row_name">row</assign>
                                      <assign to="sql">select * from SI_VERSION</assign>
                                      <assign to="." from="*"/>
                             </output>
                            
                             <input message="inmsg">
                                                <assign to="tempStorage" from="PrimaryDocument/@SCIObjectID"/>
                                    </input>
                            
                   </operation>
                   <operation name="File System Adapter">
                             <participant name="FSA_configurationName"/>
                             <output message="FileSystemInputMessage">
                                      <assign to="Action">FS_COLLECT</assign>
                                      <assign to="deleteAfterCollect">false</assign>
                                      <assign to="filter">fileNameFilter</assign>
                                      <assign to="." from="*"/>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
          </sequence>
</process>

The first step was switch to 'Allow message write' so we can get result of service into input message insted of in the Process Data. As we have input message at disposal, we can use assign in the input message that takes values/nodes from Input Message and put it into Process Data. The assign statement from the example...

<assign to="tempStorage" from="PrimaryDocument/@SCIObjectID"></assign>

 ...will take content of the Primary Document and put it into document named 'tempStorage' 

Using assign inside of input message gives the same result in Process Data as independant assign in the Example 2:

<?xml version="1.0" encoding="UTF-8"?>

<ProcessData>
          <tempStorage SCIObjectID="serverName:49b61c40:11032a4d48e:5d0f"/>
          <FileName>fileName</FileName>
          <PrimaryDocument SCIObjectID="serverName:49b61c40:11032a4d48e:5d50"/>
</ProcessData>  

Since the result of LWJDBC Adapter is always in XML format, we can use another assign to get XML tree in Process Data: 

Example 4 (Primary Document content moved directly to Process Data by DocToDOM function ): 

 <process name="default">

          <sequence>
                   <operation name="Lightweight JDBC Adapter">
                             <participant name="LightweightJDBCAdapterQuery"/>
                             <output message="LightweightJDBCAdapterTypeInputMessage">
                                      <assign to="pool">mysqlPool</assign>
                                      <assign to="query_type">SELECT</assign>
                                      <assign to="result_name">result</assign>
                                      <assign to="row_name">row</assign>
                                      <assign to="sql">select * from SI_VERSION</assign>
                                      <assign to="." from="*"/>
                             </output>
 
                             <input message="inmsg">
                                                <assign to="tempStorage" from="DocToDOM(PrimaryDocument)"/>
                                    </input>
 
                   </operation>
                   <operation name="File System Adapter">
                             <participant name="FSA_configurationName"/>
                             <output message="FileSystemInputMessage">
                                      <assign to="Action">FS_COLLECT</assign>
                                      <assign to="deleteAfterCollect">false</assign>
                                      <assign to="filter">fileNameFilter</assign>
                                      <assign to="." from="*"/>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
          </sequence>
</process>

Process Data after this business process will contain the result of LWJDBC in Process Data tree and Primary Document as the result of FSA: 

<?xml version="1.0" encoding="UTF-8"?>

<ProcessData>
          <tempStorage>
                   <result>
                             <row>
                                      <SI_VERSION>4.1.0-1976</SI_VERSION>
                                      <SI_INSTALL_DATE>2007-01-15 11:30:49</SI_INSTALL_DATE>
                                      <SI_COMMENTS>SI patch installation</SI_COMMENTS>
                                      <PRODUCT_VERSION>4.1.1</PRODUCT_VERSION>
                                      <ENGINE_VERSION>1976</ENGINE_VERSION>
                             </row>
                   </result>
          </tempStorage>
          <FileName>mimi</FileName>
          <PrimaryDocument SCIObjectID="serverName:49b61c40:11032a4d48e:6646"/>
</ProcessData>