Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache JMeter
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.jmeter.protocol.jms.client
Class ReceiveSubscriber

    java.lang.Object
      org.apache.jmeter.protocol.jms.client.ReceiveSubscriber

All Implemented Interfaces:
  Closeable, javax.jms.MessageListener

    public class ReceiveSubscriber

extends Object
implements Closeable, javax.jms.MessageListener

Generic MessageConsumer class, which has two possible strategies.

- Use MessageConsumer.receive(timeout) to fetch messages.
- Use MessageListener.onMessage() to cache messages in a local queue.

In both cases, the `getMessage(long)` method is used to return the next message, either directly using receive(timeout) or from the queue using poll(timeout).

Constructor Summary
`ReceiveSubscriber(boolean useProps, String initialContextFactory, String providerUrl, String connfactory, String destinationName, boolean useAuth, String securityPrincipal, String securityCredentials)` Constructor takes the necessary JNDI related parameters to create a connection and prepare to begin receiving messages.
`ReceiveSubscriber(int queueSize, boolean useProps, String initialContextFactory, String providerUrl, String connfactory, String destinationName, boolean useAuth, String securityPrincipal, String securityCredentials)` Constructor takes the necessary JNDI related parameters to create a connection and create an onMessageListener to prepare to begin receiving messages.

Method Summary
`void` | `close()` close() will stop the connection first.
`javax.jms.Message` | `getMessage(long timeout)` Get the next message or null.
`void` | `onMessage(javax.jms.Message message)`
`void` | `start()` Calls Connection.start() to begin receiving inbound messages.
`void` | `stop()` Calls Connection.stop() to stop receiving inbound messages.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReceiveSubscriber

    public ReceiveSubscriber(boolean useProps,
                             String initialContextFactory,
                             String providerUrl,
                             String connfactory,
                             String destinationName,
                             boolean useAuth,
                             String securityPrincipal,
                             String securityCredentials)
                      throws NamingException,
                             javax.jms.JMSException

  Constructor takes the necessary JNDI related parameters to create a connection and prepare to begin receiving messages.
  The caller must then invoke `start()` to enable message reception.

  Parameters:
    `useProps` - if true, use jndi.properties instead of initialContextFactory, providerUrl, securityPrincipal, securityCredentials
    `initialContextFactory` -
    `providerUrl` -
    `connfactory` -
    `destinationName` -
    `useAuth` -
    `securityPrincipal` -
    `securityCredentials` -
  Throws:
    `javax.jms.JMSException` - if could not create context or other problem occurred.
    `NamingException`

### ReceiveSubscriber

    public ReceiveSubscriber(int queueSize,
                             boolean useProps,
                             String initialContextFactory,
                             String providerUrl,
                             String connfactory,
                             String destinationName,
                             boolean useAuth,
                             String securityPrincipal,
                             String securityCredentials)
                      throws NamingException,
                             javax.jms.JMSException

  Constructor takes the necessary JNDI related parameters to create a connection and create an onMessageListener to prepare to begin receiving messages.
  The caller must then invoke `start()` to enable message reception.

  Parameters:
    `queueSize` - maximum queue size <=0 == no limit
    `useProps` - if true, use jndi.properties instead of initialContextFactory, providerUrl, securityPrincipal, securityCredentials
    `initialContextFactory` -
    `providerUrl` -
    `connfactory` -
    `destinationName` -
    `useAuth` -
    `securityPrincipal` -
    `securityCredentials` -
  Throws:
    `javax.jms.JMSException` - if could not create context or other problem occurred.
    `NamingException`

Method Detail

### start

    public void start()
               throws javax.jms.JMSException

  Calls Connection.start() to begin receiving inbound messages.

  Throws:
    `javax.jms.JMSException`

### stop

    public void stop()
              throws javax.jms.JMSException

  Calls Connection.stop() to stop receiving inbound messages.

  Throws:
    `javax.jms.JMSException`

### getMessage

    public javax.jms.Message getMessage(long timeout)
                                 throws javax.jms.JMSException

  Get the next message or null. Never blocks for longer than the specified timeout.

  Parameters:
    `timeout` - in milliseconds
  Returns:
    the next message or null
  Throws:
    `javax.jms.JMSException`

### close

    public void close()

  close() will stop the connection first. Then it closes the subscriber, session and connection.

  Specified by:
    `close` in interface `Closeable`

### onMessage

    public void onMessage(javax.jms.Message message)

  Specified by:
    `onMessage` in interface `javax.jms.MessageListener`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache JMeter
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.