Essential ATG Dynamo Training - Got atg Certified Relationship Management Developer?
This is not an official ATG site: ATG, Dynamo, Scenario Server and Personalization Server are trademarks or registered trademarks of Art Technology Group
Articles Exercises Resources Links Search

Read-Me for Demo Message

DOWNLOAD FILES

This sample demonstrates the local messaging in Dynamo, it can be modified to use other messaging by editing the supplied atg\dynamo\messaging\dynamoMessagingSystem.xml as described in Chapter 45 - Dynamo Message System of the Dynamo Programmers Guide.

  • Extract files into <DYNAMO_HOME>\demomessage
  • Copy index.jhtml to <doc-root>\demomessage\index.jhtml
  • Start dynamo with -m demomessage to enable the demo
  • Browse to http:\\localhost:PORT\demomessage\index.jhtml 
    where PORT is your HTTP port (default=8840)
  • Enter a text message and click 'send'
  • If everything has worked you should see information under the send form about the message that was transmitted

Notes

  • If you only have one port it must be called DEFAULT
  • The port name must be passed into the sendMessage() call otherwise the message will go to the DEFAULT port
  • Input and output port names in atg\dynamo\messaging\dynamoMessagingSystem.xml can be different. It's the affinity to the destination object which creates the relationship. The input port names are only visible to the MessageSink object and the output port names are only used by the MessageSource object

Exercise

In this exercise you'll add new output ports and topics, modify a listener to listen on several ports and create two new listeners to listen to messages on your new topics.

  1. Create two new local-jms topics; 
    • /DemoMessage/TopicHot
    • /DemoMessage/TopicCold
  2. Add two new output ports to /DemoMessage/DemoMessageSource, HOT and COLD linking them to the appropriate topics 
    • (Hint: Edit atg\dynamo\messaging\dynamoMessagingSystem.xml under demomessages\config)
  3. Modify the first listener (the existing /DemoMessage/DemoMessageSink) to pick up messages on the two new topics.
  4. Register two new 'listener' components of class DemoMessage.DemoMessageSink called DemoMessage.DemoMessageSinkHot and DemoMessage.DemoMessageSinkCold 
    • (Hint: Use the DCC, try the right-click duplicate functionality in the components window)
  5. Modify the atg\dynamo\messaging\dynamoMessagingSystem.xml under demomessages\config to register your two new components to receive messages on the new HOT and COLD topics
  6. Modify demomessage\index.jhtml to display the lastReceivedMessage of the new components

Solution

The completed XML file is shown below, this assumes that the components were registered as described in step 4 above. The complete solution is in the demomessage\solution folder

<?xml version="1.0" ?>
<dynamo-message-system>
   <local-jms>
     <topic-name>/DemoMessage/Topic</topic-name>
     <topic-name>/DemoMessage/TopicHot</topic-name>
     <topic-name>/DemoMessage/TopicCold</topic-name>
  </local-jms>

   <patchbay>
      <message-source>
        <nucleus-name>/DemoMessage/DemoMessageSource</nucleus-name>
          <output-port>
           <port-name>DEFAULT</port-name>
           <output-destination>
             <provider-name>local</provider-name>
             <destination-name>localdms:/local/DemoMessage/Topic</destination-name>
             <destination-type>Topic</destination-type>
           </output-destination>
         </output-port>
          <output-port>
           <port-name>HOT</port-name>
           <output-destination>
             <provider-name>local</provider-name>
             <destination-name>localdms:/local/DemoMessage/TopicHot</destination-name>
             <destination-type>Topic</destination-type>
           </output-destination>
         </output-port>
          <output-port>
           <port-name>COLD</port-name>
           <output-destination>
             <provider-name>local</provider-name>
             <destination-name>localdms:/local/DemoMessage/TopicCold</destination-name>
             <destination-type>Topic</destination-type>
           </output-destination>
         </output-port>
      </message-source>

      <message-sink>
        <nucleus-name>/DemoMessage/DemoMessageSink</nucleus-name>
          <input-port>
            <port-name>DEFAULT_TOPIC</port-name>
            <input-destination>
              <provider-name>local</provider-name>
              <destination-name>localdms:/local/DemoMessage/Topic</destination-name>
               <destination-type>Topic</destination-type>
            </input-destination>
         </input-port>
          <input-port>
            <port-name>HOT_TOPIC</port-name>
            <input-destination>
              <provider-name>local</provider-name>
              <destination-name>localdms:/local/DemoMessage/TopicHot</destination-name>
               <destination-type>Topic</destination-type>
            </input-destination>
         </input-port>
          <input-port>
            <port-name>COLD_TOPIC</port-name>
            <input-destination>
              <provider-name>local</provider-name>
              <destination-name>localdms:/local/DemoMessage/TopicCold</destination-name>
               <destination-type>Topic</destination-type>
            </input-destination>
         </input-port>
      </message-sink>

      <message-sink>
        <nucleus-name>/DemoMessage/DemoMessageSinkHot</nucleus-name>
          <input-port>
            <port-name>WARM</port-name>
            <input-destination>
              <provider-name>local</provider-name>
              <destination-name>localdms:/local/DemoMessage/TopicHot</destination-name>
               <destination-type>Topic</destination-type>
            </input-destination>
         </input-port>
      </message-sink>
      <message-sink>
        <nucleus-name>/DemoMessage/DemoMessageSinkCold</nucleus-name>
          <input-port>
            <port-name>COOL</port-name>
            <input-destination>
              <provider-name>local</provider-name>
              <destination-name>localdms:/local/DemoMessage/TopicCold</destination-name>
               <destination-type>Topic</destination-type>
            </input-destination>
         </input-port>
      </message-sink>
   </patchbay>

</dynamo-message-system>


Technical Training Advertise your Training Programs for Free! Los Angeles Web Design Shopping Cart Software  Form a Corporation