MessageServer (pattern 2.a)
This is also a Java thread with a Tomcat web server. It can present a web form and take in data from the web browser. Then, it queries or perform various operations on the named queues in this thread, pattern 2.b.
By being a Java thread with the correct configuration, it can receive messages coming from other system threads into its named queues.
See the Samples "Walkthrough" video for a more detailed depiction of message flow.
The .ini file example specifies
that this Java thread has KEYED_MSGS = true
, so
that named queues are enabled. RequestServer builds a message with driver control
fields MSG_KEY
and
MSG_SUBKEY
. This indicates the named queue and the sub-key of the
message.
This is an example of MessageServer.ini:
[DRIVER]
DRIVERTYPE = class # A class type or application type driver
CLASS = com/infor/cloverleaf/javadriver/samples/messageservertomcatlauncher/TomcatLauncher # The class loaded for method calls that start/stop things
STARTMETHOD = doStart # this method starts tomcat
STARTARG = apache-tomcat-7.0.8 # this specifies the tomcat folder (catalina home). It is relative to the start_DIR parameter, or it can be an absolute path.
STOPMETHOD = doStop # stops tomcat
STOPARG = # No arg needed
DELAY = 0 # Delay for Java debugger attach in seconds
MSG_MEM_MAX = 100 # Max memory use for keyed messages
KEYED_MSGS = true # Doing keyed messages?
NO_KEY_SEND = false # True does send using RUNMETHOD, false no key is error
NOTIFYMETHOD = doNotify # Class method called when new keyed message arrives
This sample also demonstrates the NOTIFYMETHOD
field in the .ini
file, with the corresponding doNotify
method. The
method only logs the notification. Every time a new keyed message comes in, the
NOTIFYMETHOD
is called.