Interface MessageManager

  • All Known Implementing Classes:
    DefaultMessageManager

    public interface MessageManager
    Message handler interface that all MQ implementations should implement, is in charge of sending a request and wait for a response to occur.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Method that should close all underlying connections and release all resources connected to the message handler.
      void connect()
      Method called by service if the underlying MessageHandler should connect to the MessageQueue server and start processing incoming calls.
      java.lang.Object getConnectionFactory()
      Method returning the JMS connection factory used in underlying classes.
      MessageHandler getMessageHandler()
      Method to return a reference to the underlying message handler used.
      void init​(java.util.Properties config, PKIMessageParser parser, java.lang.String destination)
      Initialization method that should be called before first use.
      boolean isConnected()
      Method returning if the underlying message handler is currently connected.
      PKIMessage sendMessage​(java.lang.String requestId, byte[] request)
      Method that sends a request to message server and should wait for a response.
    • Method Detail

      • init

        void init​(java.util.Properties config,
                  PKIMessageParser parser,
                  java.lang.String destination)
           throws java.lang.IllegalArgumentException,
                  java.io.IOException,
                  MessageException
        Initialization method that should be called before first use. Usually called by the MQCertificateManager.
        Parameters:
        config - configuration properties specific for a mq certificate manager. Available property keys is depending on underlying implementation.
        parser - message parser to use
        destination - the destination of sent messages
        Throws:
        java.lang.IllegalArgumentException - if arguments sent to the method were illegal or the given property file contained bad configuration.
        java.io.IOException - if communication problems occurred with underlying systems, such as time-out.
        MessageException - if there were an critical internal error at the server side, that wasn't related to communication problems.
      • connect

        void connect()
              throws MessageException,
                     java.io.IOException
        Method called by service if the underlying MessageHandler should connect to the MessageQueue server and start processing incoming calls.
        Throws:
        MessageException - if configuration problems or other internal problems occurred connecting to the MQ server.
        java.io.IOException - if communication problems occurred connecting from the message server.
      • getConnectionFactory

        java.lang.Object getConnectionFactory()
                                       throws MessageException,
                                              java.io.IOException
        Method returning the JMS connection factory used in underlying classes.

        Used only for special purposes. and requires a JMS infrastructure underneath otherwise is a PKIMessageException thrown.

        Returns:
        a connection factory to use to set up the message processing environment, never null.
        Throws:
        MessageException - if internal error or configuration problems occurred.
        java.io.IOException - if communication problems occurred with the message service.
      • getMessageHandler

        MessageHandler getMessageHandler()
        Method to return a reference to the underlying message handler used.
        Returns:
        underlying message handler used.
      • sendMessage

        PKIMessage sendMessage​(java.lang.String requestId,
                               byte[] request)
                        throws java.lang.IllegalArgumentException,
                               java.io.IOException,
                               MessageException
        Method that sends a request to message server and should wait for a response.
        Parameters:
        request - the request message to send
        Throws:
        java.lang.IllegalArgumentException - if request contained invalid data.
        java.io.IOException - if communication problems occurred with underlying systems, such as time-out.
        MessageException - if there were an critical internal error at the server side, that wasn't related to communication problems.
      • isConnected

        boolean isConnected()
        Method returning if the underlying message handler is currently connected.
        Returns:
        true if connected.
      • close

        void close()
            throws java.io.IOException
        Method that should close all underlying connections and release all resources connected to the message handler.
        Throws:
        java.io.IOException - if problems occurred closing the connections.