Class RestAcquisitionQueue


  • public class RestAcquisitionQueue
    extends Object
    The RestAcquisitionQueue class allows administrators to create REST acquisition queues (Rest bridge in).

    The Rest bridge destinations rely on a particular Joram service which purpose is to maintain valid connections with the foreign REST Joram servers. The valid properties define by this destination are:

    • rest.host: hostname or IP address of remote JMS REST server, by default "localhost".
    • rest.port: listening port of remote JMS REST server, by default 8989.
    • rest.useOldAPI: if true, use the old Rest/JMS API with authentication through query parameters.
    • rest.user: user name needed to connect to remote JMS REST server, by default "anonymous".
    • rest.pass: password needed to connect to remote JMS REST server, by default "anonymous".
    • rest.mediaTypeJson: if true the acquisition queue accepts JSON message, default true.
    • rest.timeout: Timeout for waiting for a message, by default 10.000 (10 seconds).
    • rest.idletimeout: normally each remote resource need to be explicitly closed, this parameter allows to set the idle time in seconds in which the remote context will be closed if idle. If less than or equal to 0, the context never closes. By default 60 seconds.
    • acquisition.period: delay between to attempts to receive a message if the acquisition queue doesn't use the asyncrhonous mode, by default 100 milliseconds.
    • jms.destination: the name of remote JMS destination.
    • rest.connectTimeout: configures connectTimeout for WS client.
    • rest.readTimeout: configures readTimeout for WS client.
    • rest.checkPeriod: verification period in seconds of acquisition handler. If no message has been received during this period, the handler is restarted.
    • Field Detail

      • RESTAcquisition

        public static final String RESTAcquisition
        Class name of handler allowing to acquire messages to a foreign REST provider.
        See Also:
        Constant Field Values
      • port

        private int port
      • useOldAPI

        private boolean useOldAPI
      • username

        private String username
      • password

        private String password
      • mediaTypeJson

        private boolean mediaTypeJson
      • timeout

        private long timeout
      • acquisitionPeriod

        private int acquisitionPeriod
      • idleTimeout

        private long idleTimeout
      • checkPeriod

        private long checkPeriod
    • Constructor Detail

      • RestAcquisitionQueue

        public RestAcquisitionQueue()
    • Method Detail

      • getHost

        public String getHost()
        Returns:
        the hostName
      • getPort

        public int getPort()
        Returns:
        the port
      • isUseOldAPI

        public boolean isUseOldAPI()
        Returns:
        the useOldAPI
      • setUseOldAPI

        public RestAcquisitionQueue setUseOldAPI​(boolean useOldAPI)
        Parameters:
        useOldAPI - the useOldAPI to set
      • getUsername

        public String getUsername()
        Returns:
        the userName
      • getPassword

        public String getPassword()
        Returns:
        the password
      • isMediaTypeJson

        public boolean isMediaTypeJson()
        Returns:
        the mediaTypeJson
      • setMediaTypeJson

        public RestAcquisitionQueue setMediaTypeJson​(boolean mediaTypeJson)
        Parameters:
        mediaTypeJson - the mediaTypeJson to set
      • getTimeout

        public long getTimeout()
        Returns:
        the timeout
      • setTimeout

        public RestAcquisitionQueue setTimeout​(long timeout)
        Parameters:
        timeout - the timeout to set
      • getAcquisitionPeriod

        public long getAcquisitionPeriod()
        Returns:
        the acquisitionPeriod
      • setAcquisitionPeriod

        public RestAcquisitionQueue setAcquisitionPeriod​(int acquisitionPeriod)
        Parameters:
        acquisitionPeriod - the acquisitionPeriod to set
      • getIdleTimeout

        public long getIdleTimeout()
      • getCheckPeriod

        public long getCheckPeriod()
        Returns:
        the checkPeriod.
      • setCheckPeriod

        public RestAcquisitionQueue setCheckPeriod​(long checkPeriod)
        Parameters:
        checkPeriod - the ckeckPeriod to set.
        Returns:
      • create

        public Queue create​(String dest)
                     throws ConnectException,
                            AdminException
        Administration method creating and deploying a REST acquisition queue on the local server.

        The request fails if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        dest - The name of the foreign destination.
        Returns:
        the created bridge destination.
        Throws:
        ConnectException - If the administration connection is closed or broken.
        AdminException - If the request fails.
        See Also:
        create(int, String, String, Properties)
      • create

        public Queue create​(int serverId,
                            String dest)
                     throws ConnectException,
                            AdminException
        Administration method creating and deploying a REST acquisition queue on a given server.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        dest - The name of the foreign destination.
        Returns:
        the created bridge destination.
        Throws:
        ConnectException - If the administration connection is closed or broken.
        AdminException - If the request fails.
        See Also:
        create(int, String, String, Properties)
      • create

        public Queue create​(int serverId,
                            String name,
                            String dest)
                     throws ConnectException,
                            AdminException
        Administration method creating and deploying a REST acquisition queue on a given server.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        name - The name of the created queue.
        dest - The name of the foreign destination.
        Returns:
        the created bridge destination.
        Throws:
        ConnectException - If the administration connection is closed or broken.
        AdminException - If the request fails.
        See Also:
        create(int, String, String, Properties)
      • create

        public Queue create​(int serverId,
                            String name,
                            String dest,
                            Properties props)
                     throws ConnectException,
                            AdminException
        Administration method creating and deploying a REST acquisition queue on a given server.

        In addition to properties used to configure acquisition queues a set of specific properties allows to configure Rest/JMS acquisition destination:

        • rest.host: hostname or IP address of remote JMS REST server, by default "localhost".
        • rest.port: listening port of remote JMS REST server, by default 8989.
        • rest.user: user name needed to connect to remote JMS REST server, by default "anonymous".
        • rest.pass: password needed to connect to remote JMS REST server, by default "anonymous".
        • rest.mediaTypeJson: if true the acquisition queue accepts JSON message, default true.
        • rest.timeout: Timeout for waiting for a message, by default 10.000 (10 seconds).
        • rest.idletimeout: normally each remote resource need to be explicitly closed, this parameter allows to set the idle time in seconds in which the remote context will be closed if idle. If less than or equal to 0, the context never closes. By default 60 seconds.
        • acquisition.period: delay between to attempts to receive a message if the acquisition queue doesn't use the asyncrhonous mode, by default 100 milliseconds.
        • jms.destination: the name of remote JMS destination.
        • rest.connectTimeout: configures connectTimeout for WS client.
        • rest.readTimeout: configures readTimeout for WS client.
        • additional parameters for specific WS implementation can be added.
        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        name - The name of the created queue.
        dest - The name of the foreign destination.
        props - A Properties object containing all needed parameters.
        Returns:
        the created bridge destination.
        Throws:
        ConnectException - If the administration connection is closed or broken.
        AdminException - If the request fails.