Running the Solar Pattern Authoring sample

After you have imported or imported and partially set up the sample, the pattern authoring project is automatically opened. You can now create the pattern plug-ins and run the message flow.

Creating the pattern plug-ins

You can confirm the pattern works by following these steps:

  1. In the Pattern Authoring editor, click the Create Pattern tab.
  2. Click Create Pattern Plug-ins. Four plug-ins are created in your workspace.
  3. Click Test Pattern. A new instance of the WebSphere Message Broker Toolkit is started.
  4. In the new instance of the WebSphere Message Broker Toolkit, click Pattern Explorer.
  5. Click Samples > Solar, click Create Instance.
  6. Enter a name for the pattern instance, click OK.
  7. Select a location from the Places list, or specify your own location by using decimal latitude and longitude.
  8. Click Generate. A pattern instance project is created in your workspace; a Message Broker project is also created.

You can now run the message flow.

Running the message flow

An example input test message and the corresponding output message, which is produced by the MQOutput node, are provided so that you can confirm that the sample has worked.

XML example of the input message

The test message that is used to run this sample is an XML message containing a date in Coordinated Universal Time (UTC) format (YYYY-MM-DD). The message is based on the following format, with carriage returns added to aid readability:

<?xml version="1.0" encoding="UTF-8"?>
<solar:sun xmlns:solar="http://caspian.hursley.ibm.com"
  	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  	xsi:schemaLocation="http://caspian.hursley.ibm.com solar.xsd">
  	<solar:dateQuery>2010-04-15</solar:dateQuery>
</solar:sun>

Running the message flow

To run the message flow:

  1. Open the WebSphere Message Broker Toolkit.
  2. To create a new execution group, in the Brokers view select the default configuration broker (MB8BROKER), right-click New Execution Group.
  3. Enter the name Solar, or a name of your choice. The execution group starts automatically. The execution group must be running when you deploy a message flow to it.
  4. In the Broker Development view, expand SolarMessageFlow > flows > default broker schema to show the SolarUpDown.msgflow message flow.
  5. Right-click the message flow, click Deploy.
  6. Select the execution group you created, click Finish to deploy the selected message flow to the new execution group.
  7. Open the WebSphere Message Broker Explorer.
  8. Expand Brokers > MB8BROKER, and confirm that the execution group you created is running. If not, start the execution group.
  9. Expand IBM WebSphere MQ > Queue Managers > MB8QMGR and select Queues. Confirm that you can see the following queues:
  10. To test your pattern with this message, paste it into the SOLAR WebSphere MQ queue:
    1. Copy the message:
      <?xml version="1.0" encoding="UTF-8"?>
      <solar:sun xmlns:solar="http://caspian.hursley.ibm.com"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        	xsi:schemaLocation="http://caspian.hursley.ibm.com solar.xsd">
        	<solar:dateQuery>2010-04-15</solar:dateQuery>
      </solar:sun>
      
    2. Right-click the queue.
    3. Select Put Test Message and paste in the message.

    You might want to try different dates in place of 2010-04-15.

    Note: It is important that there are no line breaks in the input message.

    Note: The times at which sunrise, sunset, and twilight occur vary, depending upon the location and the time of year. These times are not defined for some locations at certain times in the year.

  11. When the queue list refreshes (approximately every 20 seconds), notice that the queue depth for the SUNSETSUNRISETIMES queue has increased. Right-click this queue and select Browse Messages. Notice that the message data now contains the UTC dates for the sunrise, sunset, and other related events that the PHPCompute node has generated.
  12. Try varying the date and see the difference.

Expected output message from the MQOutput node

The output message from the MQOutput node is similar to the input message, but is appended with the derived sunrise and sunset times.

The following code shows the expected output message, formatted with carriage returns to aid readability.

<?xml version="1.0" encoding="UTF-8"?>
<solar:sun xmlns:solar="http://caspian.hursley.ibm.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://caspian.hursley.ibm.com solar.xsd">
  <solar:dateQuery>2010-04-15</solar:dateQuery>
  <sunEventTime>
    <sunrise>2010-04-15 06:09:34 Europe/London</sunrise>
    <sunset>2010-04-15 20:01:29 Europe/London</sunset>
    <transit>2010-04-15 13:05:31 Europe/London</transit>
    <civil_twilight_begin>2010-04-15 05:34:33 Europe/London</civil_twilight_begin>
    <civil_twilight_end>2010-04-15 20:36:29 Europe/London</civil_twilight_end>
    <nautical_twilight_begin>2010-04-15 04:51:06 Europe/London</nautical_twilight_begin>
    <nautical_twilight_end>2010-04-15 21:19:57 Europe/London</nautical_twilight_end>
    <astronomical_twilight_begin>2010-04-15 04:02:23 Europe/London</astronomical_twilight_begin>
    <astronomical_twilight_end>2010-04-15 22:08:40 Europe/London</astronomical_twilight_end>
  </sunEventTime>
</solar:sun>

Back to sample home