org.exolab.jmscts.core.service
Class MessengerServer

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--org.exolab.jmscts.core.service.MessengerServer
All Implemented Interfaces:
Messenger, java.rmi.Remote, java.io.Serializable

public class MessengerServer
extends java.rmi.server.UnicastRemoteObject
implements Messenger

This class enables messaging operations to be performed in a separate JVM

Version:
$Revision: 1.2 $ $Date: 2004/02/02 03:49:20 $
Author:
Tim Anderson
See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected MessengerServer(int port)
          Construct a new instance
 
Method Summary
static void main(java.lang.String[] args)
          Main line
 int receive(java.lang.String destination, int count, long timeout, MessageVerifier verifier)
          Receive messages from a destination
 void send(java.lang.Class message, java.lang.String destination, int count, MessagePopulator populator)
          Send messages to a destination
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessengerServer

protected MessengerServer(int port)
                   throws java.lang.Exception
Construct a new instance
Parameters:
port - the RMI registry port
Throws:
java.lang.Exception - for any error
Method Detail

send

public void send(java.lang.Class message,
                 java.lang.String destination,
                 int count,
                 MessagePopulator populator)
          throws java.lang.Exception,
                 javax.jms.JMSException
Send messages to a destination
Specified by:
send in interface Messenger
Parameters:
message - the type of the message to send
destination - the name of the destination
count - the number of messages to send
populator - the message populator (may be null)
Throws:
java.lang.Exception - if the populator fails or remote call fails
javax.jms.JMSException - if the messages can't be sent

receive

public int receive(java.lang.String destination,
                   int count,
                   long timeout,
                   MessageVerifier verifier)
            throws javax.jms.JMSException,
                   java.rmi.RemoteException
Receive messages from a destination
Specified by:
receive in interface Messenger
Parameters:
destination - the name of the destination
count - the expected number of messages to receive
timeout - the maximum time to wait for each
verifier - the message verifier (may be null)
Returns:
the actual number of messages received
Throws:
javax.jms.JMSException - if the messages can't be received
java.rmi.RemoteException - if the remote call fails

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main line
Parameters:
args - command line arguments
Throws:
java.lang.Exception - for any error


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.