|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--examples.osgi.client.MQeClientApp
Example MQe Application. This checks to see if an MQeQueueManager is already running in the JVM, if so it assumes it is running in the same runtime as the server application and so uses that QueueManager. If no QueueManager is detected then a new one is defined and started in memory and a connection definition and remote queue definition are setup to the server. Code is then run in a new thread which sends a single message to the server. No checks are made to ensure the message is received. If we created a new QueueManager for the Client then it is stopped and deleted when it is stopped by calling shutdownMQeClient(). This Example uses a helper class:
. MQeAdmin - used to configure MQe Components.This class contains the code to create and send a message. It is written this way to separate the MQe configuration code from Application code. This class is expected to be used in a particular way with the 5 main methods being called in a defined order as detailed below:
. MQeClientApp(String qmName, String regLocation) This constructor must be used, supplying the QM name and registry location to be used. . setServerAddressAndPort sets the port and address where the MQeServerApp is running . setupMQeClient() This defines and starts a QM in memory with default queues. . runJMSTest() This creates a new MQeClient and starts it in a new thread. . shutdownMQeClient() This shutsdown and deletes the QM.A main method is also supplied to enable testing of this class outside of the OSGI framework. The MQeClientApp has been written so that it can be either run in the same JVM as the MQeServerApp in which case it will share the underlying MQeQueueManager OR it can be run in its own JVM, perhaps even on a seperate machine, in this case the MQeClientApp starts has its own QueueManager. In either case the MQeServerApp should be started first. By default the MQeTcpipHttpAdapter is used for comms and the MQeMemoryFieldsAdapter is used for registry storage. The port and address where the MQeServerApp is running can be configured by using the setReceiversAddressAndPort method.
Field Summary | |
static short[] |
version
|
Constructor Summary | |
MQeClientApp(java.lang.String qmName,
java.lang.String regLocation)
Constructor to create a new MQeClientApp. |
Method Summary | |
static void |
main(java.lang.String[] args)
This main method can be used to test the example outside of the OSGI framework. |
void |
run()
Run Method Creates and sends the message. |
void |
runTest()
This starts the new MQeClientApp object in its own thread. |
void |
setServerAddressAndPort(java.lang.String targetQMIPAddress,
java.lang.String targetQMPort)
Method used to set the recievers address and port. |
void |
setupMQeClient()
Checks to see if a QM is already running. |
void |
shutdownMQeClient()
This stops the sending thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static short[] version
Constructor Detail |
public MQeClientApp(java.lang.String qmName, java.lang.String regLocation)
Method Detail |
public void run()
run
in interface java.lang.Runnable
public void setServerAddressAndPort(java.lang.String targetQMIPAddress, java.lang.String targetQMPort)
public void setupMQeClient()
public void runTest()
public void shutdownMQeClient()
public static void main(java.lang.String[] args)
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |