Websphere MQ Everyplace

examples.midp.exampleapp.textapp
Class AppModelClient

java.lang.Object
  |
  +--examples.midp.exampleapp.textapp.AppModel
        |
        +--examples.midp.exampleapp.textapp.AppModelClient
All Implemented Interfaces:
MessageConsumer, java.lang.Runnable

public class AppModelClient
extends AppModel

The aim of the client model is to register with the registration server and be prepared to send messages to the gateway server. Unlike the message pump, messages will only be sent by the request of the user.

To achieve these goals, remote queues to the gateway and registration reply and request queues are required as well as a connection to both those servers.

Since everything is driven by user input, almost all the work is done by the client controller. The model mainly sets the queue manager up correctly to allow it to perform its functions.


Field Summary
static short[] version
           
 
Fields inherited from class examples.midp.exampleapp.textapp.AppModel
DEFAULT_CLIENT_QM, DEFAULT_GATEWAY, DEFAULT_GATEWAY_QM, DEFAULT_HOMESERVER_Q, DEFAULT_LISTENER_PORT, DEFAULT_REGISTRATION, DEFAULT_REGISTRATION_LISTENER_PORT, DEFAULT_REGISTRATION_Q, DEFAULT_REGISTRATION_QM, DEFAULT_REGISTRATION_REPLY_Q, DEFAULT_REPLY_Q, DEFAULT_REQUEST_Q, DEFAULT_RULES, GatewayCommand, GatewayOptions, RegistrationCommand, RegistrationOptions
 
Constructor Summary
AppModelClient()
           
 
Method Summary
protected  java.lang.String[] chooseConnections()
          Need connections to the reg and gateway servers.
protected  java.lang.String[] chooseRemoteQueues()
          We require the ability to send to the request queue of the gateway server and to request a registration (and check the reply) from the reg server.
protected  int getListenerPort()
          (client shouldn't have a listener but returns something anyway).
protected  void initialConfiguration()
          Configures the model - clients need to register with the central server.
protected  void initializeOtherQueues()
          A home server queue on the gateway is used by the client.
protected  boolean isServer()
          This is not a server.
 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.
protected  void setProperty(java.lang.String property, java.lang.String value)
          Sets a property of the model.
 
Methods inherited from class examples.midp.exampleapp.textapp.AppModel
chooseLocalQueues, clearLocalQueues, createListener, getController, getLocalQMname, getMsgService, initializeConnections, initializeLocalQueues, initializeRemoteQueues, monitorLocalQueues, processStatus, registerWithCentral, run, sendNewMessage, setLocalQMname, setMsgService, start, statusReport, stop
 
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
Constructor Detail

AppModelClient

public AppModelClient()
Method Detail

isServer

protected boolean isServer()
This is not a server.

Specified by:
isServer in class AppModel
Returns:
boolean - true if server, false if client
See Also:
AppModel.isServer()

setProperty

protected void setProperty(java.lang.String property,
                           java.lang.String value)
Sets a property of the model.


initializeOtherQueues

protected void initializeOtherQueues()
                              throws java.lang.Exception
A home server queue on the gateway is used by the client.

Specified by:
initializeOtherQueues in class AppModel
Returns:
void
java.lang.Exception
See Also:
AppModel.initializeOtherQueues()

initialConfiguration

protected void initialConfiguration()
                             throws java.lang.Exception
Configures the model - clients need to register with the central server.

Overrides:
initialConfiguration in class AppModel
Returns:
void
java.lang.Exception
See Also:
AppModel.initialConfiguration()

chooseRemoteQueues

protected java.lang.String[] chooseRemoteQueues()
We require the ability to send to the request queue of the gateway server and to request a registration (and check the reply) from the reg server.

Overrides:
chooseRemoteQueues in class AppModel
See Also:
AppModel.chooseRemoteQueues()

chooseConnections

protected java.lang.String[] chooseConnections()
Need connections to the reg and gateway servers.

Overrides:
chooseConnections in class AppModel
See Also:
AppModel.chooseConnections()

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)

getListenerPort

protected int getListenerPort()
(client shouldn't have a listener but returns something anyway).

Specified by:
getListenerPort in class AppModel
Returns:
int - port to listen on
See Also:
AppModel.getListenerPort()

Websphere MQ Everyplace