|
|||||||||
| Home >> All >> com >> presumo >> [ jms overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.presumo.jms
Class JmsServer

java.lang.Objectcom.presumo.jms.JmsServer
- public class JmsServer
- extends java.lang.Object
Encapsulation of a Presumo JMS server. Any application may start a JMS server within their application with the following steps.
- Instantiate the server with the constructor that is appropriate to your application's needs.
- Start the server with
startup() - Start every type of server listener that is needed. To start
a tcp socket listener on
127.0.0.1:2323call:-
startServerTransport("tcp://127.0.0.1:2323").
-
- Connect the server to other servers if needed. To connect
to a server at 192.168.1.1 running a TCP listener on port 2323
you would call:
-
startClientTransport("tcp://192.168.1.1:2323")
-
Currently, only TCP/IP connections are supported.
If you want to use Presumo for intra-JVM communication you do not
need to create an instance of this class. All message consumers
and producers created from the same javax.jms.Connection
can communicate with each other without a server. Only producers
and consumers created from different javax.jms.Connection's
will need a server to communicate.
| Field Summary | |
private java.util.Map |
clientMap
|
private com.presumo.util.log.Logger |
logger
|
protected java.lang.String |
persistentDir
The directory to store messages queues which will contain persistent messages. |
protected int |
persistentLogSize
Once the persistent queue size on disk (in bytes) is greater than this value it will be compressed and internal fragmentation caused by deleted messages will be removed. |
protected java.lang.String |
persistentPrefix
If using persistent messages, the files created by Presumo will have this prefix. |
private com.presumo.jms.router.Router |
router
|
private java.util.Map |
serverMap
|
| Constructor Summary | |
JmsServer()
Create a server with no mechanisms to transactionally store messages on the disk. |
|
JmsServer(java.lang.String persistentDir)
Create a server which will create transactional queues for the storage of persistent messages in the given directory. |
|
JmsServer(java.lang.String persistentDir,
java.lang.String persistentPrefix)
Create a server which will create transactional queues for the storage of persistent messages in the given directory. |
|
JmsServer(java.lang.String persistentDir,
java.lang.String persistentPrefix,
int persistentLogSize)
Create a server which will create transactional queues for the storage of persistent messages in the given directory. |
|
| Method Summary | |
protected void |
finalize()
Augment the basic functionality by shutting down the server and releasing all resources before being garbage collected. |
private java.lang.String |
getHost(java.lang.String url)
|
private int |
getPort(java.lang.String url)
|
static void |
main(java.lang.String[] args)
Used to invoke a JVM with just the Presumo JMS server running within it. |
void |
shutdown()
Stops the server. |
void |
startClientTransport(java.lang.String url)
Start a client transport to connect to another server. |
void |
startServerTransport(java.lang.String url)
Start a built-in server transport mechanism to listen for and accept connections from client transport mechanismism of the same protocal. |
void |
startup()
Starts the server, but you must specifically create server listners or connections to other servers via startServerTransport()
and startClientTransport(). |
void |
stopClientTransport(java.lang.String url)
Stop a client transpot connected to another server. |
void |
stopServerTransport(java.lang.String url)
Stop the given server transport. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
persistentDir
protected final java.lang.String persistentDir
- The directory to store messages queues which will contain persistent
messages. If set to
nullthe JmsServer will not write anything to disk and persistent messages will not be much more reliable than non-persistent messages.
persistentPrefix
protected final java.lang.String persistentPrefix
- If using persistent messages, the files created by Presumo will have
this prefix.
persistentLogSize
protected final int persistentLogSize
- Once the persistent queue size on disk (in bytes) is greater than
this value it will be compressed and internal fragmentation caused
by deleted messages will be removed.
logger
private final com.presumo.util.log.Logger logger
serverMap
private java.util.Map serverMap
clientMap
private java.util.Map clientMap
router
private com.presumo.jms.router.Router router
| Constructor Detail |
JmsServer
public JmsServer()
- Create a server with no mechanisms to transactionally store messages
on the disk. All persistent and non-persistent messages will be kept
in memory. You should only use the server if you are not using
persistent messages.
JmsServer
public JmsServer(java.lang.String persistentDir)
- Create a server which will create transactional queues for the
storage of persistent messages in the given directory. The
directory must be ths same between application reboots. It
is erroneous to use a temporary directory since the queues
must servive a reboot.
JmsServer
public JmsServer(java.lang.String persistentDir, java.lang.String persistentPrefix)
- Create a server which will create transactional queues for the
storage of persistent messages in the given directory. The
directory must be ths same between application reboots. It
is erroneous to use a temporary directory since the queues
must servive a reboot.
You may change the prefix of all files created by Presumo using this constructor. The default value is "PresumoJms".
The prefix must be the same across reboots and cannot change. If you change the prefix name, all stored messages using the previous prefix name will be lost.
JmsServer
public JmsServer(java.lang.String persistentDir, java.lang.String persistentPrefix, int persistentLogSize)
- Create a server which will create transactional queues for the
storage of persistent messages in the given directory. The
directory must be ths same between application reboots. It
is erroneous to use a temporary directory since the queues
must servive a reboot.
You may change the prefix of all files created by Presumo using this constructor. The default value is "PresumoJms".
The prefix must be the same across reboots and cannot change. If you change the prefix name, all stored messages using the previous prefix name will be lost.
You may also specify the max size in bytes the log file size will get before the persistent mechanism resolves the contents to a more permanent file.
The default value is 100,000 bytes which is a good number for small messages (less than 1K) but might need to be larger for larger messages.
| Method Detail |
startup
public void startup()
throws javax.jms.JMSException
- Starts the server, but you must specifically create server listners
or connections to other servers via
startServerTransport()andstartClientTransport().
shutdown
public void shutdown()
- Stops the server. The server will disconnect with all other servers it
is connected to and will disconnect all clients.
startServerTransport
public void startServerTransport(java.lang.String url) throws javax.jms.JMSException
- Start a built-in server transport mechanism to listen for and
accept connections from client transport mechanismism of the
same protocal.
The format of the passed in
urlshould be:protocal://inetaddress:port- protocal - Identifier for built-in protocal.
- inetaddress - Address to run the protocal on. The loopback address is usually correct here (i.e. 127.0.0.1 or localhost). The one exception is a multi-homed machine.
- port - Port the protocal should listen on.
stopServerTransport
public void stopServerTransport(java.lang.String url)
- Stop the given server transport.
startClientTransport
public void startClientTransport(java.lang.String url) throws javax.jms.JMSException
- Start a client transport to connect to another server.
stopClientTransport
public void stopClientTransport(java.lang.String url)
- Stop a client transpot connected to another server.
finalize
protected void finalize()
throws java.lang.Throwable
- Augment the basic functionality by shutting down the server and
releasing all resources before being garbage collected.
getHost
private java.lang.String getHost(java.lang.String url) throws javax.jms.JMSException
getPort
private int getPort(java.lang.String url) throws javax.jms.JMSException
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Used to invoke a JVM with just the Presumo JMS server running within it.
- Usage: java com.presumo.jms.JmsServer [config.properties]
|
|||||||||
| Home >> All >> com >> presumo >> [ jms overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.presumo.jms.JmsServer