Progress
AppBuilder
Developer’s Guide


Batch Mode: Starting and Stopping a SmartConsumer

Three properties are generally required before running SmartConsumer object in batch mode, if SonicMQ security checking is turned on. They are JMSUser, JMSPassword, and ClientID. Strictly speaking, ClientID is not required except when needed to distinguish between sessions using the same user identifier and password.

At present, you can set those properties in the instance properties dialog box or from the command line using the -param startup parameter:

prowin32 -b -p containerfilename -param “jmsuser,jmspassword,clientid” . 

In the example shown, containerfilename would be the filename of a Simple SmartContainer that contains a SmartConsumer object and a SmartRouter object. The values you pass in the parameter string override any values set at design time using the Instance Properties dialog box.

Stopping a SmartConsumer

The most orderly way to shut down a SmartConsumer object running in batch mode is to send a message to the designated shutdown topic or queue. You identify that topic or queue at design time in the Shutdown property.

The shutdown message needs no body; its receipt by the shutdown Queue or Topic is sufficient.

When the SmartConsumer detects reception of a message in that Queue/Topic, it sends a shutdown message to its container object. Shutting down the container object shuts down all objects in the container (including the SmartConsumer itself) as well as any containers that were started by the SmartRouter to which the SmartConsumer is connected.

To set up and test a shutdown mechanism, follow these general steps:

  1. Create a Simple SmartContainer
  2. Create and place a SmartProducer in the SmartContainer. Set Message Type to HeaderMessage and configure other properties appropriately.
  3. Create and place a SmartSender in the SmartContainer. If an Advisor offers to create an OUTMESSAGE link to the SmartProducer, accept the offer; otherwise, create the link using the SmartLinks editor. Set the Destination property to be the shutdown destination for the consumer, for example “Shutdown”. Any message this SmartProducer sends will then be a shutdown message.
  4. Open a Section Editor window and create a local override procedure called initializeObject. Insert this RUN statement as the procedure body:
    RUN sendMessage IN THIS-PROCEDURE. 
    
  5. Save your work using a distinctive filename, for example stopconsumer. To test this shutdown mechanism, enter this statement on the command line:
    prowin32 -b -p stopconsumer.w 
    


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095