Websphere MQ Everyplace

examples.midp.exampleapp.msgpump
Class MsgPumpModelClient

java.lang.Object
  |
  +--examples.midp.exampleapp.msgpump.MsgPumpModel
        |
        +--examples.midp.exampleapp.msgpump.MsgPumpModelClient
All Implemented Interfaces:
MessageConsumer, java.lang.Runnable

public class MsgPumpModelClient
extends MsgPumpModel

This is the client implementation of the message pump model. What this means is that the logic required pump the messages to a server is located in this class. The actual implementation of that logic (creating and sending admin messages etc) is done in the Message Service. The interaction with the user is done by the controller, which also controls such things as where the messages are being pumped to and how fast.


Field Summary
static short[] version
           
 
Fields inherited from class examples.midp.exampleapp.msgpump.MsgPumpModel
compressor, cryptor, DEFAULT_SECURITY, DEFAULT_SERVER_Q_NAME, DEFAULT_SERVER_QM_NAME, MESSAGE_SECURITY, NO_SECURITY, QUEUE_SECURITY, SECURITY_KEY, sync
 
Method Summary
 java.lang.String getServerAddress()
          Gets the address that messages will be pumped to.
 java.lang.String getServerQMname()
          Gets the name of the server's queue manager that is being pumped to.
 java.lang.String getServerQname()
          Gets the name of the queue on the server that is being pumped to.
 long getWaitTime()
          Get the wait time of the client.
 void pause()
          Pauses the model.
protected  void performInitialConfiguration()
          The client only requires a remote queue as it is not expecting to receive any messages.
 void processDataGramMsg(MQeMsgObject message, java.lang.String qMgrName, java.lang.String qName)
          A datagram message has been received.
 void processReplyMsg(MQeMsgObject message, java.lang.String qMgrName, java.lang.String qName)
          A reply message has been received.
 void processRequestMsg(MQeMsgObject message, java.lang.String qMgrName, java.lang.String qName)
          A new request message has been received.
 void resume()
          Resumes the model.
 void run()
          The client of the message pump will send a message every [timeBetweenMsgs] milliseconds to the server until it is stopped or [maxMsgsToSend] messages have been sent.
protected  void setProperty(java.lang.String property, java.lang.String value)
          sets a property of the pump
 void setWaitTime(long wait)
          Set how long the pump should wait between messages.
 void stop()
          Called when something wants the model to stop.
 
Methods inherited from class examples.midp.exampleapp.msgpump.MsgPumpModel
createMessageAttribute, finish, getController, getLocalQMname, getMessageAttribute, getMsgService, getQMrules, getTimestamp, initialize, isSecurity, padNumber, processStatus, setController
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static short[] version
Method Detail

setProperty

protected void setProperty(java.lang.String property,
                           java.lang.String value)
sets a property of the pump

Overrides:
setProperty in class MsgPumpModel
Parameters:
property - The property to set
value - The value to set it to
Returns:
void

getServerAddress

public java.lang.String getServerAddress()
Gets the address that messages will be pumped to.
e.g. Network://127.0.0.1:8082.

Returns:
String - the address of the server

run

public void run()
The client of the message pump will send a message every [timeBetweenMsgs] milliseconds to the server until it is stopped or [maxMsgsToSend] messages have been sent.

Returns:
void

stop

public void stop()
Description copied from class: MsgPumpModel
Called when something wants the model to stop. Returns whether the caller should wait on the model until it is done or not.

Specified by:
stop in class MsgPumpModel
Returns:
boolean
See Also:
MsgPumpModel.stop()

pause

public void pause()
Description copied from class: MsgPumpModel
Pauses the model.

Specified by:
pause in class MsgPumpModel
Returns:
void
See Also:
MsgPumpModel.pause()

resume

public void resume()
Description copied from class: MsgPumpModel
Resumes the model.

Specified by:
resume in class MsgPumpModel
Returns:
void
See Also:
MsgPumpModel.resume()

setWaitTime

public void setWaitTime(long wait)
Set how long the pump should wait between messages.

Parameters:
wait - Wait time in milliseconds
Returns:
void

getWaitTime

public long getWaitTime()
Get the wait time of the client.

Returns:
long - wait time in milliseconds

performInitialConfiguration

protected void performInitialConfiguration()
                                    throws java.lang.Exception
The client only requires a remote queue as it is not expecting to receive any messages.

Specified by:
performInitialConfiguration in class MsgPumpModel
Returns:
void
java.lang.Exception
See Also:
MsgPumpModel.performInitialConfiguration()

processDataGramMsg

public void processDataGramMsg(MQeMsgObject message,
                               java.lang.String qMgrName,
                               java.lang.String qName)
Description copied from interface: MessageConsumer
A datagram message has been received.

Parameters:
message - The message to display
qMgrName - The queue manager the message is on
qName - The queue the message is on
Returns:
void
See Also:
MessageConsumer.processDataGramMsg(MQeMsgObject, String, String)

processReplyMsg

public void processReplyMsg(MQeMsgObject message,
                            java.lang.String qMgrName,
                            java.lang.String qName)
Description copied from interface: MessageConsumer
A reply message has been received.

Parameters:
message - The message to display
qMgrName - The queue manager the message is on
qName - The queue the message is on
Returns:
void
See Also:
MessageConsumer.processReplyMsg(MQeMsgObject, String, String)

processRequestMsg

public void processRequestMsg(MQeMsgObject message,
                              java.lang.String qMgrName,
                              java.lang.String qName)
Description copied from interface: MessageConsumer
A new request message has been received. Note, the message still exists on the queue, it has been browsed so will stay on the queue until a get or delete operation.

Parameters:
message - The message to display.
qMgrName - The queue manager the message is on
qName - The queue the message is on
Returns:
void
See Also:
MessageConsumer.processRequestMsg(MQeMsgObject, String, String)

getServerQMname

public java.lang.String getServerQMname()
Gets the name of the server's queue manager that is being pumped to.

Returns:
String - the name of the server queue manager

getServerQname

public java.lang.String getServerQname()
Gets the name of the queue on the server that is being pumped to.

Returns:
String - the name of the queue being pumped to

Websphere MQ Everyplace