|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--examples.midp.exampleapp.textapp.AppModel
The aim of the text app is to have 3 queue managers:
The Gateway server - a server that will be sent messages.
The Registration server - a server that new clients have to register with
before they can send messages to the gateway.
The Client - a client that send messages to the gateway.
The aim of this example is to show how a registration server can be used to create the necessary resources for a new client. This approach gives several advantages to larger networks of MQe devices.
This class implements a basic model for a text app. Functions are available to create listeners, define queues and sends messages for both clients and servers.
The message service is used to connunicate with the underlying MQe structure to simplify the design of the code.
Field Summary | |
static java.lang.String |
DEFAULT_CLIENT_QM
Default name for the client QM. |
static java.lang.String |
DEFAULT_GATEWAY
Default location for the gatewar server. |
static java.lang.String |
DEFAULT_GATEWAY_QM
Default name for the gateway QM. |
static java.lang.String |
DEFAULT_HOMESERVER_Q
Default name for a home server queue. |
static int |
DEFAULT_LISTENER_PORT
Default port for listeners. |
static java.lang.String |
DEFAULT_REGISTRATION
Default location for the registration server. |
static int |
DEFAULT_REGISTRATION_LISTENER_PORT
Default port for listeners on the registration QM. |
static java.lang.String |
DEFAULT_REGISTRATION_Q
Default name for the registration queue. |
static java.lang.String |
DEFAULT_REGISTRATION_QM
Default name for the registration QM. |
static java.lang.String |
DEFAULT_REGISTRATION_REPLY_Q
Default name for the registration reply queue. |
static java.lang.String |
DEFAULT_REPLY_Q
Default name for a reply queue. |
static java.lang.String |
DEFAULT_REQUEST_Q
Default name for a request queue. |
static java.lang.String |
DEFAULT_RULES
Default rules file to use. |
static java.lang.String |
GatewayCommand
|
static java.lang.String |
GatewayOptions
|
static java.lang.String |
RegistrationCommand
|
static java.lang.String |
RegistrationOptions
|
static short[] |
version
|
Constructor Summary | |
AppModel()
|
Method Summary | |
protected java.lang.String[] |
chooseConnections()
Return a list of connections used by the model. |
protected java.lang.String[] |
chooseLocalQueues()
Return a list of local queues used by the model. |
protected java.lang.String[] |
chooseRemoteQueues()
Return a list of remote queues used by the model. |
protected void |
clearLocalQueues()
Clears all local queues as defined by localQueues[]. |
protected void |
createListener()
Generates a name for the listener from the queue manager and creates it. |
AppController |
getController()
Gets the controller. |
protected abstract int |
getListenerPort()
Returns the port that the queue manager listens on. |
java.lang.String |
getLocalQMname()
Gets the localQMname. |
MQeMessageService |
getMsgService()
Gets the msgService. |
protected void |
initialConfiguration()
Called if the queue manager has not been started up previously. |
protected void |
initializeConnections()
This creates all the connections specified in connections[]. |
protected void |
initializeLocalQueues()
This creates all the local queues specified in localQueues[]. |
protected abstract void |
initializeOtherQueues()
This creates all less common queues that a queue manager may need ( home server queues, store and forward queues etc). |
protected void |
initializeRemoteQueues()
This creates all the remote queues specified in remoteQueues[]. |
protected abstract boolean |
isServer()
Used to check whether the model is a client or server. |
protected void |
monitorLocalQueues()
Will start monitoring of all local queues as specified in localQueues[]. |
void |
processStatus(java.lang.String msg)
Displays a message using the controller or if no controller is set, prints it to System.out. |
void |
registerWithCentral(java.lang.String QMname,
java.lang.String Qname)
Used to register a queue manager with the registration server. |
void |
run()
Starts the model running (initialize should have been run first). |
void |
sendNewMessage(java.lang.String message)
Sends a message to the default queue on the default queue manager. |
void |
setLocalQMname(java.lang.String localQMname)
Sets the localQMname. |
void |
setMsgService(MQeMessageService msgService)
Sets the msgService. |
void |
start(AppController controller,
java.lang.String localQMname)
Initializes the model and all necessary components. |
protected java.lang.String |
statusReport()
Produces a status report for the queue manager. |
void |
stop()
Stops the model and clears any local queues of messages befor closing the message service. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface examples.midp.exampleapp.messageservice.MessageConsumer |
processDataGramMsg, processReplyMsg, processRequestMsg |
Field Detail |
public static short[] version
public static final java.lang.String DEFAULT_REGISTRATION_QM
public static final java.lang.String DEFAULT_GATEWAY_QM
public static final java.lang.String DEFAULT_CLIENT_QM
public static final int DEFAULT_LISTENER_PORT
public static final int DEFAULT_REGISTRATION_LISTENER_PORT
This is to allow the gateway and registration QMs on the same machine.
public static final java.lang.String DEFAULT_GATEWAY
public static final java.lang.String DEFAULT_REGISTRATION
public static final java.lang.String GatewayCommand
public static final java.lang.String GatewayOptions
public static final java.lang.String RegistrationCommand
public static final java.lang.String RegistrationOptions
public static final java.lang.String DEFAULT_REQUEST_Q
public static final java.lang.String DEFAULT_REPLY_Q
public static final java.lang.String DEFAULT_REGISTRATION_Q
public static final java.lang.String DEFAULT_REGISTRATION_REPLY_Q
public static final java.lang.String DEFAULT_HOMESERVER_Q
public static final java.lang.String DEFAULT_RULES
Constructor Detail |
public AppModel()
Method Detail |
public void run()
run
in interface java.lang.Runnable
public void start(AppController controller, java.lang.String localQMname) throws java.lang.Exception
controller
- The model's controllerlocalQMname
- The name for local queue manager
java.lang.Exception
protected void initialConfiguration() throws java.lang.Exception
java.lang.Exception
protected void createListener() throws java.lang.Exception
java.lang.Exception
protected java.lang.String[] chooseConnections()
protected java.lang.String[] chooseLocalQueues()
protected java.lang.String[] chooseRemoteQueues()
protected void initializeConnections() throws java.lang.Exception
java.lang.Exception
protected void initializeLocalQueues() throws java.lang.Exception
java.lang.Exception
protected void initializeRemoteQueues() throws java.lang.Exception
java.lang.Exception
protected void monitorLocalQueues() throws java.lang.Exception
java.lang.Exception
protected void clearLocalQueues()
public void processStatus(java.lang.String msg)
processStatus
in interface MessageConsumer
msg
- The message to be displayed
public void registerWithCentral(java.lang.String QMname, java.lang.String Qname) throws java.lang.Exception
Registering involves simply sending a message to the registration server and waiting for a reply. The reply will contain a success bool indicating whether the registration was a success or not.
QMname
- The name of the queue managerQname
- The name of the queue
java.lang.Exception
public void stop() throws java.lang.Exception
java.lang.Exception
public java.lang.String getLocalQMname()
public void setLocalQMname(java.lang.String localQMname)
localQMname
- The localQMname to set
public MQeMessageService getMsgService()
public void setMsgService(MQeMessageService msgService)
msgService
- The msgService to set
public AppController getController()
public void sendNewMessage(java.lang.String message) throws java.lang.Exception
message
- The message to send
java.lang.Exception
protected java.lang.String statusReport()
protected abstract boolean isServer()
This design has problem with expandability if, in the future, a server that registers with the central server is required.
protected abstract void initializeOtherQueues() throws java.lang.Exception
java.lang.Exception
protected abstract int getListenerPort()
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |