Websphere MQ Everyplace

examples.midp.exampleapp.textapp
Class AppModelRegistrationServer

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

public class AppModelRegistrationServer
extends AppModelServer

The aim of the registration server is to give an example of how a server can be used to provide resources for new clients. In this case, when a client registers with the server, it will be added to a store and forward queue on the gateway. This is a simple example of how resources can be set up for clients by another queue manager, allow greater flexibility and scalability in the design of the system.

If the registration succeeds or fails, a reply is left for the client on the registration server's reply queue informing them of the success / failure of the registration.


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
AppModelRegistrationServer()
           
 
Method Summary
protected  java.lang.String[] chooseConnections()
          Return a list of connections used by the model.
protected  java.lang.String[] chooseLocalQueues()
          Need request and reply registration queues as well as a normal reply queue.
protected  java.lang.String[] chooseRemoteQueues()
          Return a list of remote queues used by the model.
protected  MQeMsgObject createRegistrationReplyMsg(java.lang.String regQMname)
          Creates a reply message for a queue manager that has just been registered.
protected  void createResourcesForNewClientQM(java.lang.String regQMname)
          Add resource definitions required for a client on the central site for instance add client as a target to a store and forward queue, add remote queue definition to big MQ
protected  int getListenerPort()
          Returns the port that the queue manager listens on.
protected  void initializeOtherQueues()
          Reg server has no other queues to initialize.
protected  void processRegistrationRequest(MQeMsgObject msg)
          Called upon reveiving a new registration request from a client.
 void processReplyMsg(MQeMsgObject message, java.lang.String qMgrName, java.lang.String qName)
          The registration server has no need to deal with reply messages.
 void processRequestMsg(MQeMsgObject msg, java.lang.String qMgrName, java.lang.String qName)
          A new request message has been received, do something with it for instance display it.
 
Methods inherited from class examples.midp.exampleapp.textapp.AppModelServer
initialConfiguration, isServer, processDataGramMsg, processMessage
 
Methods inherited from class examples.midp.exampleapp.textapp.AppModel
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

AppModelRegistrationServer

public AppModelRegistrationServer()
Method Detail

chooseLocalQueues

protected java.lang.String[] chooseLocalQueues()
Need request and reply registration queues as well as a normal reply queue.

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

initializeOtherQueues

protected void initializeOtherQueues()
                              throws java.lang.Exception

Reg server has no other queues to initialize.

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

chooseRemoteQueues

protected java.lang.String[] chooseRemoteQueues()
Description copied from class: AppModel
Return a list of remote queues used by the model.

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

chooseConnections

protected java.lang.String[] chooseConnections()
Description copied from class: AppModel
Return a list of connections used by the model.

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

createRegistrationReplyMsg

protected MQeMsgObject createRegistrationReplyMsg(java.lang.String regQMname)
                                           throws java.lang.Exception
Creates a reply message for a queue manager that has just been registered.

Parameters:
regQMname - The name of the queue manager that has been registered
Returns:
MQeMsgObject - the reply message to send to the queue manager
java.lang.Exception

createResourcesForNewClientQM

protected void createResourcesForNewClientQM(java.lang.String regQMname)
                                      throws java.lang.Exception
Add resource definitions required for a client on the central site for instance add client as a target to a store and forward queue, add remote queue definition to big MQ

Parameters:
regQMname - Name of the queue manager to be registered
Returns:
void
java.lang.Exception

processRegistrationRequest

protected void processRegistrationRequest(MQeMsgObject msg)
                                   throws java.lang.Exception
Called upon reveiving a new registration request from a client. Used to set up all the required resources for the client.

Parameters:
msg - The request message
Returns:
void
java.lang.Exception

processRequestMsg

public void processRequestMsg(MQeMsgObject msg,
                              java.lang.String qMgrName,
                              java.lang.String qName)
A new request message has been received, do something with it for instance display it.

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:
msg - The message to display.
qMgrName - The queue manager the message is on
qName - The queue the message is on
Returns:
void

processReplyMsg

public void processReplyMsg(MQeMsgObject message,
                            java.lang.String qMgrName,
                            java.lang.String qName)
The registration server has no need to deal with reply messages.

Parameters:
message - The message to display.
qMgrName - The queue manager the message is on
qName - The queue the message is on
Returns:
void

getListenerPort

protected int getListenerPort()
Description copied from class: AppModel
Returns the port that the queue manager listens on. (unimportant to clients, as they don't have listeners).

Overrides:
getListenerPort in class AppModelServer
See Also:
AppModel.getListenerPort()

Websphere MQ Everyplace