Running the Message Routing sample is split into two scenarios:
These two scenarios are described separately. All of the test messages that are used in this section are stored in the Test messages directory in the Message routing sample message flows Integration project.
If you encounter any problems when you run the sample, see Resolving problems when running samples in the IBM Integration Bus documentation.
All of the test messages that are used to run this sample are based on the following format:
<SaleEnvelope> <Header> <SaleListCount>1</SaleListCount> </Header> <SaleList> <Invoice> <Initial>T</Initial> <Initial>D</Initial> <Surname>Montana</Surname> <Item><Code>00</Code> <Code>01</Code><Code>02</Code> <Description>Twister</Description> <Category>Games</Category> <Price>00.30</Price> <Quantity>01</Quantity> </Item> <Item> <Code>02</Code><Code>03</Code><Code>01</Code> <Description>The Times Newspaper</Description> <Category>Books and Media</Category> <Price>00.20</Price> <Quantity>01</Quantity> </Item> <Balance>00.50</Balance> <Currency>Sterling</Currency> </Invoice> </SaleList> <Trailer> <CompletionTime>12.00.00</CompletionTime> </Trailer> </SaleEnvelope>
The Initial and Surname fields are used for routing the message.
This part of the sample uses the Routing_using_database_table message flow. The message flow contains one input queue called ROUTING.DATABASE.IN1. The message flow can route the message to one of 20 output queues based on the content of the message (ROUTING.OUT followed by a number from 1-19 plus a queue called ROUTING.DEFAULT). To run this part of the sample:
If all of the preceding steps are successful, the first part of the sample is complete. To find out how the routing is programed, look at the ESQL in the message flow, see Routing_using_database_table_Compute.
This part of the sample makes use of the Routing_using_memory_cache message flow. It contains two input queues called ROUTING.DATABASE.MEMORY.IN1 and ROUTING.REFRESH.IN1. The message flow can route the message to one of 20 queues based on the content of the message (ROUTING.OUT followed by a number from 1-19 plus a queue called ROUTING.DEFAULT). The routing logic is the same as in the non-cached version, the difference is that the database is cached in-memory by using shared variables. Use the following steps to run this part of the sample:
DB2
db2cmd
db2
DB2> connect to ROUTING user user using passwordWhere user is a user that has the authority to access the ROUTING database, typically the same user that was used to create the sample integration node; and password is the password that is used for that user.
DB2> update routing_table set queue_name='ROUTING.OUT18' where Variable3='Braithwaite'
DB2> disconnect ROUTING
Oracle
sqlplus <user>/<password>Where user is a user that has the authority to access the routing_table table, typically the same user that was used to create the sample integration node; and password is the password that is used for that user.
update routing_table set queue_name='ROUTING.OUT18' where Variable3='Braithwaite';
Steps 9-13 can be repeated by changing the queue_name in the database to one of the other queue names that are available. Instead of using the Database_Refresh_cache_message1 message you can stop and restart the message flow, which also causes the cached database table to refresh.
If all of the preceding steps are successful, the sample is complete. To find out how to store the database in shared variables, look at the ESQL in the message flow, see Routing_using_database_and_memory_cache_Compute.
The Message Routing sample routes the input test message to various output queues without modifying the output. The output message is identical to the input test message, see Input test messages. The steps given in the two scenarios detail to where the messages are routed. You can check that the messages are routed to the correct queue by using WebSphere MQ Explorer as well as by using Dequeue in the Test Client.