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

## org.mule.transport
Class AbstractConnector

    java.lang.Object
      org.mule.transport.AbstractConnector

All Implemented Interfaces:
  EventListener, javax.resource.spi.work.WorkListener, Disposable, Initialisable, Lifecycle, LifecycleStateEnabled, Startable, Stoppable, NamedObject, Connectable, Connector

Direct Known Subclasses:
  AbstractJndiConnector, AbstractMailConnector, AxisConnector, FileConnector, FtpConnector, IBeansConnector, JdbcConnector, JettyHttpConnector, JmsConnector, MessageProcessorPollingConnector, NullConnector, QuartzConnector, ServletConnector, StdioConnector, TcpConnector, UdpConnector, VMConnector, XmppConnector

    public abstract class AbstractConnector

extends Object
implements Connector, javax.resource.spi.work.WorkListener

`AbstractConnector` provides base functionality for all connectors provided with Mule. Connectors are the mechanism used to connect to external systems and protocols in order to send and receive data.

The `AbstractConnector` provides getter and setter methods for endpoint name, transport name and protocol. It also provides methods to stop and start connectors and sets up a dispatcher threadpool which allows deriving connectors the possibility to dispatch work to separate threads. This functionality is controlled with the doThreading property on the threadingProfiles for dispatchers and receivers. The lifecycle for a connector is -

1. Create
2. Initialise
3. Connect
4. Connect receivers
5. Start
6. Start Receivers
7. Stop
8. Stop Receivers
9. Disconnect
10. Disconnect Receivers
11. Dispose
12. Dispose Receivers

Field Summary
`protected edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean` | `connected`
`protected boolean` | `createMultipleTransactedReceivers`
`static int` | `DEFAULT_NUM_CONCURRENT_TX_RECEIVERS` Default number of concurrent transactional receivers.
`protected MessageDispatcherFactory` | `dispatcherFactory` Factory used to create dispatchers for this connector
`protected ConfigurableKeyedObjectPoolFactory` | `dispatcherPoolFactory` A factory for creating the pool of dispatchers for this connector.
`protected ConfigurableKeyedObjectPool` | `dispatchers` A pool of dispatchers for this connector, keyed by endpoint
`protected boolean` | `initialStateStopped` The will cause the connector not to start when `start()` is called.
`protected ConnectorLifecycleManager` | `lifecycleManager`
`protected Log` | `logger` logger used by this class
`protected MuleContext` | `muleContext`
`protected MuleMessageFactory` | `muleMessageFactory` Factory used to create new `MuleMessage` instances
`protected String` | `name` The name that identifies the endpoint
`protected int` | `numberOfConcurrentTransactedReceivers`
`static String` | `PROPERTY_POLLING_FREQUENCY`
`protected Map<Object,MessageReceiver>` | `receivers` The collection of listeners on this connector.
`protected MessageRequesterFactory` | `requesterFactory` Factory used to create requesters for this connector
`protected GenericKeyedObjectPool` | `requesters` A pool of requesters for this connector, keyed by endpoint
`protected TransportServiceDescriptor` | `serviceDescriptor` Holds the service configuration for this connector
`protected Properties` | `serviceOverrides` The map of service overrides that can be used to extend the capabilities of the connector
`protected SessionHandler` | `sessionHandler` The strategy used for reading and writing session information to and from the transport
`protected boolean` | `startOnConnect` Indicates whether the connector should start upon connecting.

Fields inherited from interface org.mule.api.transport.Connector
`INT_VALUE_NOT_SET`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`AbstractConnector(MuleContext context)`

Method Summary
`protected void` | `clearDispatchers()`
`protected void` | `clearRequesters()`
`protected void` | `configureDispatcherPool()`
`void` | `connect()` Make the connection to the underlying transport.
`MessageProcessor` | `createDispatcherMessageProcessor(OutboundEndpoint endpoint)`
`MuleMessageFactory` | `createMuleMessageFactory()` Create a `MuleMessageFactory` from this connector's configuration, typically through the transport descriptor.
`protected MessageReceiver` | `createReceiver(FlowConstruct flowConstruct, InboundEndpoint endpoint)` Create a Message receiver for this connector
`protected edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService` | `createScheduler()`
`void` | `destroyReceiver(MessageReceiver receiver, ImmutableEndpoint endpoint)`
`void` | `disconnect()` Disconnect the from the underlying transport
`void` | `dispose()` A lifecycle method where implementor should free up any resources.
`protected void` | `disposeReceivers()`
`protected void` | `disposeWorkManagers()`
`protected abstract void` | `doConnect()` Template method where any connections should be made for the connector
`protected abstract void` | `doDisconnect()` Template method where any connected resources used by the connector should be disconnected
`protected abstract void` | `doDispose()` Template method to perform any work when destroying the connectoe
`protected abstract void` | `doInitialise()`
`protected abstract void` | `doStart()` Template method to perform any work when starting the connectoe
`protected abstract void` | `doStop()` Template method to perform any work when stopping the connectoe
`protected void` | `doUnregisterListener(FlowConstruct flowConstruct, InboundEndpoint endpoint, MessageReceiver receiver)`
`void` | `exceptionThrown(Exception e)`
`void` | `fireNotification(ServerNotification notification)` Fires a server notification to all registered listeners
`protected String` | `getConnectEventId()` The resource id used when firing ConnectEvents from this connector
`String` | `getConnectionDescription()` Returns a string identifying the underlying resource
`MessageExchangePattern` | `getDefaultExchangePattern()`
`List<Transformer>` | `getDefaultInboundTransformers(ImmutableEndpoint endpoint)`
`List<Transformer>` | `getDefaultOutboundTransformers(ImmutableEndpoint endpoint)`
`List<Transformer>` | `getDefaultResponseTransformers(ImmutableEndpoint endpoint)`
`MessageDispatcherFactory` | `getDispatcherFactory()` The dispatcher factory is used to create a message dispatcher of the current request
`ConfigurableKeyedObjectPoolFactory` | `getDispatcherPoolFactory()`
`ThreadingProfile` | `getDispatcherThreadingProfile()` Getter for property 'dispatcherThreadingProfile'.
`protected WorkManager` | `getDispatcherWorkManager()` Returns a work manager for message dispatchers.
`List<MessageExchangePattern>` | `getInboundExchangePatterns()`
`LifecycleState` | `getLifecycleState()`
`int` | `getMaxDispatchersActive()` Returns the maximum number of dispatchers that can be concurrently active per endpoint.
`int` | `getMaxRequestersActive()` Returns the maximum number of requesters that can be concurrently active per endpoint.
`int` | `getMaxTotalDispatchers()` Returns the maximum number of dispatchers that can be concurrently active for all endpoints.
`MuleContext` | `getMuleContext()`
`MuleMessageFactory` | `getMuleMessageFactory()` The connector creates a `MuleMessageFactory` lazily and holds a reference to it for others to use.
`String` | `getName()` Gets the name of the object
`int` | `getNumberOfConcurrentTransactedReceivers()` Returns the number of concurrent receivers that will be launched when `isCreateMultipleTransactedReceivers()` returns `true`.
`List<MessageExchangePattern>` | `getOutboundExchangePatterns()`
`OutputStream` | `getOutputStream(OutboundEndpoint endpoint, MuleEvent event)` Will get the output stream for this type of transport.
`MessageReceiver` | `getReceiver(FlowConstruct flowConstruct, InboundEndpoint endpoint)`
`protected Object` | `getReceiverKey(FlowConstruct flowConstruct, InboundEndpoint endpoint)` The method determines the key used to store the receiver against.
`Map<Object,MessageReceiver>` | `getReceivers()` Getter for property 'receivers'.
`MessageReceiver[]` | `getReceivers(String wildcardExpression)`
`ThreadingProfile` | `getReceiverThreadingProfile()` Getter for property 'receiverThreadingProfile'.
`protected WorkManager` | `getReceiverWorkManager()` Returns a work manager for message receivers.
`ReplyToHandler` | `getReplyToHandler(ImmutableEndpoint endpoint)` Getter for property 'replyToHandler'.
`MessageRequesterFactory` | `getRequesterFactory()` The requester factory is used to create a message requester of the current request
`ThreadingProfile` | `getRequesterThreadingProfile()` Getter for property 'requesterThreadingProfile'.
`protected WorkManager` | `getRequesterWorkManager()` Returns a work manager for message requesters.
`RetryPolicyTemplate` | `getRetryPolicyTemplate()`
`edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService` | `getScheduler()` Returns a Scheduler service for periodic tasks, currently limited to internal use.
`protected TransportServiceDescriptor` | `getServiceDescriptor()` Get the `TransportServiceDescriptor` for this connector.
`Map` | `getServiceOverrides()` A map of fully qualified class names that should override those in the connectors' service descriptor This map will be null if there are no overrides
`SessionHandler` | `getSessionHandler()` Getter for property 'sessionHandler'.
`List` | `getSupportedProtocols()` Returns an unmodifiable list of the protocols supported by this connector
`void` | `handleException(Exception exception)`
`protected void` | `handleWorkException(javax.resource.spi.work.WorkEvent event, String type)`
`protected void` | `initFromServiceDescriptor()` Initialises this connector from its `TransportServiceDescriptor` This will be called before the `doInitialise()` method is called.
`void` | `initialise()` Method used to perform any initialisation work.
`void` | `initialiseFromUrl(EndpointURI endpointUri)` When this connector is created via the `TransportFactory` the endpoint used to determine the connector type is passed to this method so that any properties set on the endpoint that can be used to initialise the connector are made available.
`protected void` | `initWorkManagers()`
`boolean` | `isConnected()` Determines if this object is connected or not
`boolean` | `isCreateMultipleTransactedReceivers()` For better throughput when using TransactedMessageReceivers this will enable a number of concurrent receivers, based on the value returned by `getNumberOfConcurrentTransactedReceivers()`.
`boolean` | `isDisposed()`
`boolean` | `isEnableMessageEvents()`
`boolean` | `isInitialised()`
`boolean` | `isInitialStateStopped()` The will cause the connector not to start when `start()` is called.
`boolean` | `isResponseEnabled()`
`boolean` | `isStarted()`
`boolean` | `isStopped()`
`boolean` | `isValidateConnections()` Whether to test a connection on each take from pool.
`MessageReceiver` | `lookupReceiver(String key)`
`void` | `registerListener(InboundEndpoint endpoint, MessageProcessor messageProcessorChain, FlowConstruct flowConstruct)` Registers a MessageProcessor listener which will listen to new message received from a specific transport channel and then processed by the endpoint.
`void` | `registerSupportedMetaProtocol(String protocol)` Used by Meta endpoint descriptors to register support for endpoint of the meta endpoint type.
`void` | `registerSupportedProtocol(String protocol)` Registers other protocols 'understood' by this connector.
`protected void` | `registerSupportedProtocolWithoutPrefix(String protocol)` Registers other protocols 'understood' by this connector.
`MuleMessage` | `request(InboundEndpoint endpoint, long timeout)` Make a specific request to the underlying transport
`MuleMessage` | `request(String uri, long timeout)` Make a specific request to the underlying transport
`void` | `setConnected(boolean flag)`
`void` | `setCreateMultipleTransactedReceivers(boolean createMultipleTransactedReceivers)`
`void` | `setDispatcherFactory(MessageDispatcherFactory dispatcherFactory)` The dispatcher factory is used to create a message dispatcher of the current request
`void` | `setDispatcherPoolFactory(ConfigurableKeyedObjectPoolFactory dispatcherPoolFactory)` Allows to define a factory to create the dispatchers pool that will be used in the connector
`void` | `setDispatcherPoolMaxWait(int maxWait)` Allows a maxWait timeout to be configured on the dispatcher object pool See: `GenericKeyedObjectPool.setMaxWait(long)`
`void` | `setDispatcherPoolWhenExhaustedAction(byte whenExhaustedAction)` Allows an ExhaustedAction to be configured on the dispatcher object pool See: `GenericKeyedObjectPool.setWhenExhaustedAction(byte)`
`void` | `setDispatcherThreadingProfile(ThreadingProfile dispatcherThreadingProfile)` Setter for property 'dispatcherThreadingProfile'.
`void` | `setDynamicNotification(boolean dynamic)`
`void` | `setInitialStateStopped(boolean initialStateStopped)` The will cause the connector not to start when `start()` is called.
`void` | `setMaxDispatchersActive(int maxActive)` Configures the maximum number of dispatchers that can be concurrently active per endpoint
`void` | `setMaxRequestersActive(int maxActive)` Configures the maximum number of requesters that can be concurrently active per endpoint
`void` | `setName(String newName)` Sets the name of the object
`void` | `setNumberOfConcurrentTransactedReceivers(int count)`
`void` | `setReceiverThreadingProfile(ThreadingProfile receiverThreadingProfile)` Setter for property 'receiverThreadingProfile'.
`void` | `setRequesterFactory(MessageRequesterFactory requesterFactory)` The requester factory is used to create a message requester of the current request
`void` | `setRequesterPoolMaxWait(int maxWait)` Allows a maxWait timeout to be configured on the requester object pool See: `GenericKeyedObjectPool.setMaxWait(long)`
`void` | `setRequesterPoolWhenExhaustedAction(byte whenExhaustedAction)` Allows an ExhaustedAction to be configured on the requester object pool See: `GenericKeyedObjectPool.setWhenExhaustedAction(byte)`
`void` | `setRequesterThreadingProfile(ThreadingProfile requesterThreadingProfile)` Setter for property 'requesterThreadingProfile'.
`void` | `setRetryPolicyTemplate(RetryPolicyTemplate retryPolicyTemplate)`
`void` | `setServiceOverrides(Map serviceOverrides)` Set the Service overrides on this connector.
`void` | `setSessionHandler(SessionHandler sessionHandler)` Setter for property 'sessionHandler'.
`void` | `setSupportedProtocols(List supportedProtocols)` Sets A list of protocols that the connector can accept
`protected void` | `setupDispatchReturn(OutboundEndpoint endpoint, MessageDispatcher dispatcher, MuleMessage result)` This method will return the dispatcher to the pool or, if the payload is an inputstream, replace the payload with a new DelegatingInputStream which returns the dispatcher to the pool when the stream is closed.
`protected void` | `setupRequestReturn(InboundEndpoint endpoint, MessageRequester requester, MuleMessage result)` This method will return the requester to the pool or, if the payload is an inputstream, replace the payload with a new DelegatingInputStream which returns the requester to the pool when the stream is closed.
`void` | `setValidateConnections(boolean validateConnections)` Whether to test a connection on each take.
`protected void` | `shutdownScheduler()`
`void` | `start()`
`protected void` | `startAfterConnect()`
`void` | `stop()`
`boolean` | `supportsProtocol(String protocol)`
`String` | `toString()`
`void` | `unregisterListener(InboundEndpoint endpoint, FlowConstruct flowConstruct)` Unregisters the listener for the given endpoints.
`void` | `unregisterSupportedProtocol(String protocol)`
`protected void` | `updateCachedNotificationHandler()`
`RetryContext` | `validateConnection(RetryContext retryContext)` Override this method to test whether the connector is able to connect to its resource(s).
`void` | `workAccepted(javax.resource.spi.work.WorkEvent event)`
`void` | `workCompleted(javax.resource.spi.work.WorkEvent event)`
`void` | `workRejected(javax.resource.spi.work.WorkEvent event)`
`void` | `workStarted(javax.resource.spi.work.WorkEvent event)`

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

Methods inherited from interface org.mule.api.transport.Connector
`getProtocol`

Field Detail

### DEFAULT_NUM_CONCURRENT_TX_RECEIVERS

    public static final int DEFAULT_NUM_CONCURRENT_TX_RECEIVERS

  Default number of concurrent transactional receivers.

  See Also:
    Constant Field Values

### PROPERTY_POLLING_FREQUENCY

    public static final String PROPERTY_POLLING_FREQUENCY

See Also:
  Constant Field Values

### logger

    protected final Log logger

  logger used by this class

### name

    protected volatile String name

  The name that identifies the endpoint

### dispatcherFactory

    protected volatile MessageDispatcherFactory dispatcherFactory

  Factory used to create dispatchers for this connector

### requesterFactory

    protected volatile MessageRequesterFactory requesterFactory

  Factory used to create requesters for this connector

### muleMessageFactory

    protected MuleMessageFactory muleMessageFactory

  Factory used to create new `MuleMessage` instances

### dispatchers

    protected volatile ConfigurableKeyedObjectPool dispatchers

  A pool of dispatchers for this connector, keyed by endpoint

### dispatcherPoolFactory

    protected volatile ConfigurableKeyedObjectPoolFactory dispatcherPoolFactory

  A factory for creating the pool of dispatchers for this connector.

### requesters

    protected final GenericKeyedObjectPool requesters

  A pool of requesters for this connector, keyed by endpoint

### receivers

    protected final Map<Object,MessageReceiver> receivers

  The collection of listeners on this connector. Keyed by entrypoint

### createMultipleTransactedReceivers

    protected volatile boolean createMultipleTransactedReceivers

See Also:
  `isCreateMultipleTransactedReceivers()`

### numberOfConcurrentTransactedReceivers

    protected volatile int numberOfConcurrentTransactedReceivers

See Also:
  `getNumberOfConcurrentTransactedReceivers()`

### serviceDescriptor

    protected volatile TransportServiceDescriptor serviceDescriptor

  Holds the service configuration for this connector

### serviceOverrides

    protected volatile Properties serviceOverrides

  The map of service overrides that can be used to extend the capabilities of the connector

### sessionHandler

    protected volatile SessionHandler sessionHandler

  The strategy used for reading and writing session information to and from the transport

### muleContext

    protected MuleContext muleContext

### lifecycleManager

    protected ConnectorLifecycleManager lifecycleManager

### connected

    protected edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean connected

### startOnConnect

    protected boolean startOnConnect

  Indicates whether the connector should start upon connecting. This is necessary to support asynchronous retry policies, otherwise the start() method would block until connection is successful.

### initialStateStopped

    protected boolean initialStateStopped

  The will cause the connector not to start when `start()` is called. The only way to start the connector is to call `setInitialStateStopped(boolean)` with 'false' and then calling `start()`. This flag is used internally since some connectors that rely on external servers may need to wait for that server to become available before starting

Constructor Detail

### AbstractConnector

    public AbstractConnector(MuleContext context)

Method Detail

### getName

    public String getName()

  Description copied from interface: `NamedObject`
  Gets the name of the object

  Specified by:
    `getName` in interface `NamedObject`
  Returns:
    the name of the object

### setName

    public void setName(String newName)

  Description copied from interface: `NamedObject`
  Sets the name of the object

  Specified by:
    `setName` in interface `NamedObject`
  Parameters:
    `newName` - the name of the object

### getLifecycleState

    public LifecycleState getLifecycleState()

  Specified by:
    `getLifecycleState` in interface `LifecycleStateEnabled`

### initialise

    public final void initialise()
                          throws InitialisationException

  Description copied from interface: `Initialisable`
  Method used to perform any initialisation work. If a fatal error occurs during initialisation an `InitialisationException` should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a `RecoverableException` should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

  Specified by:
    `initialise` in interface `Initialisable`
  Throws:
    `InitialisationException` - if a fatal error occurs causing the Mule instance to shutdown
    `RecoverableException` - if an error occurs that can be recovered from

### start

    public final void start()
                     throws MuleException

  Specified by:
    `start` in interface `Startable`
  Throws:
    `MuleException`

### startAfterConnect

    protected void startAfterConnect()
                              throws MuleException

  Throws:
    `MuleException`

### stop

    public final void stop()
                    throws MuleException

  Specified by:
    `stop` in interface `Stoppable`
  Throws:
    `MuleException`

### dispose

    public final void dispose()

  Description copied from interface: `Disposable`
  A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

  Specified by:
    `dispose` in interface `Disposable`

### isStarted

    public final boolean isStarted()

  Specified by:
    `isStarted` in interface `Connector`
  Returns:
    true if the endpoint is started

### isInitialised

    public boolean isInitialised()

### isStopped

    public boolean isStopped()

### configureDispatcherPool

    protected void configureDispatcherPool()

### createMuleMessageFactory

    public MuleMessageFactory createMuleMessageFactory()
                                                throws CreateException

  Create a `MuleMessageFactory` from this connector's configuration, typically through the transport descriptor.

  Attention! This method is not meant to be used by client code directly. It is only publicly available to service message receivers which should be used as real factories to create `MuleMessage` instances.

  Specified by:
    `createMuleMessageFactory` in interface `Connector`
  Throws:
    `CreateException`
  See Also:
    `MessageReceiver.createMuleMessage(Object)`, `MessageReceiver.createMuleMessage(Object, String)`

### shutdownScheduler

    protected void shutdownScheduler()

### initWorkManagers

    protected void initWorkManagers()
                             throws MuleException

  Throws:
    `MuleException`

### disposeWorkManagers

    protected void disposeWorkManagers()

### disposeReceivers

    protected void disposeReceivers()

### clearDispatchers

    protected void clearDispatchers()

### clearRequesters

    protected void clearRequesters()

### isDisposed

    public boolean isDisposed()

  Specified by:
    `isDisposed` in interface `Connector`
  Returns:
    false if the connector is alive and well or true if the connector is being destroyed

### handleException

    public void handleException(Exception exception)

  Specified by:
    `handleException` in interface `Connector`
  Parameters:
    `exception` - the exception that was caught

### exceptionThrown

    public void exceptionThrown(Exception e)

### getDispatcherFactory

    public MessageDispatcherFactory getDispatcherFactory()

  Description copied from interface: `Connector`
  The dispatcher factory is used to create a message dispatcher of the current request

  Specified by:
    `getDispatcherFactory` in interface `Connector`
  Returns:
    Returns the dispatcherFactory.

### setDispatcherFactory

    public void setDispatcherFactory(MessageDispatcherFactory dispatcherFactory)

  Description copied from interface: `Connector`
  The dispatcher factory is used to create a message dispatcher of the current request

  Specified by:
    `setDispatcherFactory` in interface `Connector`
  Parameters:
    `dispatcherFactory` - The dispatcherFactory to set.

### getRequesterFactory

    public MessageRequesterFactory getRequesterFactory()

  Description copied from interface: `Connector`
  The requester factory is used to create a message requester of the current request

  Specified by:
    `getRequesterFactory` in interface `Connector`
  Returns:
    Returns the requesterFactory.

### setRequesterFactory

    public void setRequesterFactory(MessageRequesterFactory requesterFactory)

  Description copied from interface: `Connector`
  The requester factory is used to create a message requester of the current request

  Specified by:
    `setRequesterFactory` in interface `Connector`
  Parameters:
    `requesterFactory` - The requesterFactory to set.

### getMuleMessageFactory

    public MuleMessageFactory getMuleMessageFactory()
                                             throws CreateException

  The connector creates a `MuleMessageFactory` lazily and holds a reference to it for others to use.

  The typical use case is to share a single `MuleMessageFactory` between all `MessageDispatcher`, `MessageReceiver` and `MessageRequester` instances belonging to this connector.

  Throws:
    `CreateException`

### isInitialStateStopped

    public boolean isInitialStateStopped()

  The will cause the connector not to start when `start()` is called. The only way to start the connector is to call `setInitialStateStopped(boolean)` with 'false' and then calling `start()`. This flag is used internally since some connectors that rely on external servers may need to wait for that server to become available before starting.

  Returns:
    true if the connector is not to be started with normal lifecycle, flase otherwise
  Since:
    3.0.0

### setInitialStateStopped

    public void setInitialStateStopped(boolean initialStateStopped)

  The will cause the connector not to start when `start()` is called. The only way to start the connector is to call `setInitialStateStopped(boolean)` with 'false' and then calling `start()`. This flag is used internally since some connectors that rely on external servers may need to wait for that server to become available before starting. The only time this method should be used is when a subclassing connector needs to delay the start lifecycle due to a dependence on an external system. Most users can ignore this.

  Parameters:
    `initialStateStopped` - true to stop the connector starting through normal lifecycle. It will be the responsibility of the code that sets this property to start the connector
  Since:
    3.0.0

### getMaxDispatchersActive

    public int getMaxDispatchersActive()

  Returns the maximum number of dispatchers that can be concurrently active per endpoint.

  Returns:
    max. number of active dispatchers

### getMaxTotalDispatchers

    public int getMaxTotalDispatchers()

  Returns the maximum number of dispatchers that can be concurrently active for all endpoints.

  Returns:
    max. total number of active dispatchers

### setMaxDispatchersActive

    public void setMaxDispatchersActive(int maxActive)

  Configures the maximum number of dispatchers that can be concurrently active per endpoint

  Parameters:
    `maxActive` - max. number of active dispatchers

### getMaxRequestersActive

    public int getMaxRequestersActive()

  Returns the maximum number of requesters that can be concurrently active per endpoint.

  Returns:
    max. number of active requesters

### setMaxRequestersActive

    public void setMaxRequestersActive(int maxActive)

  Configures the maximum number of requesters that can be concurrently active per endpoint

  Parameters:
    `maxActive` - max. number of active requesters

### registerListener

    public void registerListener(InboundEndpoint endpoint,
                                 MessageProcessor messageProcessorChain,
                                 FlowConstruct flowConstruct)
                          throws Exception

  Description copied from interface: `Connector`
  Registers a MessageProcessor listener which will listen to new message received from a specific transport channel and then processed by the endpoint. Only a single listener can be registered for a given endpoints. Attempts to register a listener when one is already registered will fail.

  Specified by:
    `registerListener` in interface `Connector`
  Parameters:
    `endpoint` - defines both the transport and channel/resource uri as well the processing (transformation/filtering) that should occur when the endpoint processes a new message from the transport receiver.
    `messageProcessorChain` - the listener that will be invoked when messages are received on the endpoint.
  Throws:
    `Exception`

### getReceiverKey

    protected Object getReceiverKey(FlowConstruct flowConstruct,
                                    InboundEndpoint endpoint)

  The method determines the key used to store the receiver against.

  Parameters:
    `flowConstruct` - the service for which the endpoint is being registered
    `endpoint` - the endpoint being registered for the service
  Returns:
    the key to store the newly created receiver against

### unregisterListener

    public final void unregisterListener(InboundEndpoint endpoint,
                                         FlowConstruct flowConstruct)
                                  throws Exception

  Description copied from interface: `Connector`
  Unregisters the listener for the given endpoints. This will mean that the listener that was registered for this endpoint will no longer receive any messages.

  Specified by:
    `unregisterListener` in interface `Connector`
  Throws:
    `Exception`

### doUnregisterListener

    protected void doUnregisterListener(FlowConstruct flowConstruct,
                                        InboundEndpoint endpoint,
                                        MessageReceiver receiver)

### getDispatcherThreadingProfile

    public ThreadingProfile getDispatcherThreadingProfile()

  Getter for property 'dispatcherThreadingProfile'.

  Returns:
    Value for property 'dispatcherThreadingProfile'.

### setDispatcherThreadingProfile

    public void setDispatcherThreadingProfile(ThreadingProfile dispatcherThreadingProfile)

  Setter for property 'dispatcherThreadingProfile'.

  Parameters:
    `dispatcherThreadingProfile` - Value to set for property 'dispatcherThreadingProfile'.

### getRequesterThreadingProfile

    public ThreadingProfile getRequesterThreadingProfile()

  Getter for property 'requesterThreadingProfile'.

  Returns:
    Value for property 'requesterThreadingProfile'.

### setRequesterThreadingProfile

    public void setRequesterThreadingProfile(ThreadingProfile requesterThreadingProfile)

  Setter for property 'requesterThreadingProfile'.

  Parameters:
    `requesterThreadingProfile` - Value to set for property 'requesterThreadingProfile'.

### getReceiverThreadingProfile

    public ThreadingProfile getReceiverThreadingProfile()

  Getter for property 'receiverThreadingProfile'.

  Returns:
    Value for property 'receiverThreadingProfile'.

### setReceiverThreadingProfile

    public void setReceiverThreadingProfile(ThreadingProfile receiverThreadingProfile)

  Setter for property 'receiverThreadingProfile'.

  Parameters:
    `receiverThreadingProfile` - Value to set for property 'receiverThreadingProfile'.

### destroyReceiver

    public void destroyReceiver(MessageReceiver receiver,
                                ImmutableEndpoint endpoint)
                         throws Exception

  Throws:
    `Exception`

### doInitialise

    protected abstract void doInitialise()
                                  throws InitialisationException

  Throws:
    `InitialisationException`

### doDispose

    protected abstract void doDispose()

  Template method to perform any work when destroying the connectoe

### doStart

    protected abstract void doStart()
                             throws MuleException

  Template method to perform any work when starting the connectoe

  Throws:
    `MuleException` - if the method fails

### doStop

    protected abstract void doStop()
                            throws MuleException

  Template method to perform any work when stopping the connectoe

  Throws:
    `MuleException` - if the method fails

### getDefaultInboundTransformers

    public List<Transformer> getDefaultInboundTransformers(ImmutableEndpoint endpoint)

### getDefaultResponseTransformers

    public List<Transformer> getDefaultResponseTransformers(ImmutableEndpoint endpoint)

### getDefaultOutboundTransformers

    public List<Transformer> getDefaultOutboundTransformers(ImmutableEndpoint endpoint)

### getReplyToHandler

    public ReplyToHandler getReplyToHandler(ImmutableEndpoint endpoint)

  Getter for property 'replyToHandler'.

  Returns:
    Value for property 'replyToHandler'.

### fireNotification

    public void fireNotification(ServerNotification notification)

  Fires a server notification to all registered listeners

  Parameters:
    `notification` - the notification to fire.

### isResponseEnabled

    public boolean isResponseEnabled()

  Specified by:
    `isResponseEnabled` in interface `Connector`

### getReceiver

    public MessageReceiver getReceiver(FlowConstruct flowConstruct,
                                       InboundEndpoint endpoint)

### getReceivers

    public Map<Object,MessageReceiver> getReceivers()

  Getter for property 'receivers'.

  Returns:
    Value for property 'receivers'.

### lookupReceiver

    public MessageReceiver lookupReceiver(String key)

### getReceivers

    public MessageReceiver[] getReceivers(String wildcardExpression)

### connect

    public void connect()
                 throws Exception

  Description copied from interface: `Connectable`
  Make the connection to the underlying transport. The fact that this object is connected or not should have no influence on the lifecycle, especially the start / stop state if applicable.

  Specified by:
    `connect` in interface `Connectable`
  Throws:
    `Exception`

### validateConnection

    public RetryContext validateConnection(RetryContext retryContext)

  Override this method to test whether the connector is able to connect to its resource(s). This will allow a retry policy to go into effect in the case of failure.

  Specified by:
    `validateConnection` in interface `Connectable`
  Returns:
    retry context with a success flag or failure details
  See Also:
    `RetryContext.isOk()`, `RetryContext.getLastFailure()`

### disconnect

    public void disconnect()
                    throws Exception

  Description copied from interface: `Connectable`
  Disconnect the from the underlying transport

  Specified by:
    `disconnect` in interface `Connectable`
  Throws:
    `Exception`

### getConnectionDescription

    public String getConnectionDescription()

  Description copied from interface: `Connectable`
  Returns a string identifying the underlying resource

  Specified by:
    `getConnectionDescription` in interface `Connectable`

### isConnected

    public final boolean isConnected()

  Description copied from interface: `Connectable`
  Determines if this object is connected or not

  Specified by:
    `isConnected` in interface `Connectable`
  Specified by:
    `isConnected` in interface `Connector`

### setConnected

    public final void setConnected(boolean flag)

### doConnect

    protected abstract void doConnect()
                               throws Exception

  Template method where any connections should be made for the connector

  Throws:
    `Exception`

### doDisconnect

    protected abstract void doDisconnect()
                                  throws Exception

  Template method where any connected resources used by the connector should be disconnected

  Throws:
    `Exception`

### getConnectEventId

    protected String getConnectEventId()

  The resource id used when firing ConnectEvents from this connector

  Returns:
    the resource id used when firing ConnectEvents from this connector

### isCreateMultipleTransactedReceivers

    public boolean isCreateMultipleTransactedReceivers()

  For better throughput when using TransactedMessageReceivers this will enable a number of concurrent receivers, based on the value returned by `getNumberOfConcurrentTransactedReceivers()`. This property is used by transports that support transactions, specifically receivers that extend the TransactedPollingMessageReceiver.

  Returns:
    true if multiple receivers will be enabled for this connection

### setCreateMultipleTransactedReceivers

    public void setCreateMultipleTransactedReceivers(boolean createMultipleTransactedReceivers)

  Parameters:
    `createMultipleTransactedReceivers` - if true, multiple receivers will be created for this connection
  See Also:
    `isCreateMultipleTransactedReceivers()`

### getNumberOfConcurrentTransactedReceivers

    public int getNumberOfConcurrentTransactedReceivers()

  Returns the number of concurrent receivers that will be launched when `isCreateMultipleTransactedReceivers()` returns `true`.

  See Also:
    `DEFAULT_NUM_CONCURRENT_TX_RECEIVERS`

### setNumberOfConcurrentTransactedReceivers

    public void setNumberOfConcurrentTransactedReceivers(int count)

  Parameters:
    `count` - the number of concurrent transacted receivers to start
  See Also:
    `getNumberOfConcurrentTransactedReceivers()`

### setDynamicNotification

    public void setDynamicNotification(boolean dynamic)

### updateCachedNotificationHandler

    protected void updateCachedNotificationHandler()

### isEnableMessageEvents

    public boolean isEnableMessageEvents()

### registerSupportedProtocol

    public void registerSupportedProtocol(String protocol)

  Registers other protocols 'understood' by this connector. These must contain scheme meta info. Any protocol registered must begin with the protocol of this connector, i.e. If the connector is axis the protocol for jms over axis will be axis:jms. Here, 'axis' is the scheme meta info and 'jms' is the protocol. If the protocol argument does not start with the connector's protocol, it will be appended.

  Parameters:
    `protocol` - the supported protocol to register

### registerSupportedMetaProtocol

    public void registerSupportedMetaProtocol(String protocol)

  Used by Meta endpoint descriptors to register support for endpoint of the meta endpoint type. For example an RSS endpoint uses the Http connector. By registering 'rss' as a supported meta protocol, this connector can be used when creating RSS endpoints.

  Parameters:
    `protocol` - the meta protocol that can be used with this connector
  Since:
    3.0.0

### registerSupportedProtocolWithoutPrefix

    protected void registerSupportedProtocolWithoutPrefix(String protocol)

  Registers other protocols 'understood' by this connector. These must contain scheme meta info. Unlike the `registerSupportedProtocol(String)` method, this allows you to register protocols that are not prefixed with the connector protocol. This is useful where you use a Service Finder to discover which Transport implementation to use. For example the 'wsdl' transport is a generic 'finder' transport that will use Axis or CXF to create the WSDL client. These transport protocols would be wsdl-axis and wsdl-cxf, but they can all support 'wsdl' protocol too.

  Parameters:
    `protocol` - the supported protocol to register

### unregisterSupportedProtocol

    public void unregisterSupportedProtocol(String protocol)

### supportsProtocol

    public boolean supportsProtocol(String protocol)

  Specified by:
    `supportsProtocol` in interface `Connector`
  Returns:
    true if the protocol is supported by this connector.

### getSupportedProtocols

    public List getSupportedProtocols()

  Returns an unmodifiable list of the protocols supported by this connector

  Returns:
    an unmodifiable list of the protocols supported by this connector

### setSupportedProtocols

    public void setSupportedProtocols(List supportedProtocols)

  Sets A list of protocols that the connector can accept

  Parameters:
    `supportedProtocols` -

### getReceiverWorkManager

    protected WorkManager getReceiverWorkManager()
                                          throws MuleException

  Returns a work manager for message receivers.

  Throws:
    `MuleException`

### getDispatcherWorkManager

    protected WorkManager getDispatcherWorkManager()
                                            throws MuleException

  Returns a work manager for message dispatchers.

  Throws:
    `MuleException` - in case of error

### getRequesterWorkManager

    protected WorkManager getRequesterWorkManager()
                                           throws MuleException

  Returns a work manager for message requesters.

  Throws:
    `MuleException` - in case of error

### getScheduler

    public edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService getScheduler()

  Returns a Scheduler service for periodic tasks, currently limited to internal use. Note: getScheduler() currently conflicts with the same method in the Quartz transport

### createScheduler

    protected edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService createScheduler()

### getSessionHandler

    public SessionHandler getSessionHandler()

  Getter for property 'sessionHandler'.

  Specified by:
    `getSessionHandler` in interface `Connector`
  Returns:
    Value for property 'sessionHandler'.

### setSessionHandler

    public void setSessionHandler(SessionHandler sessionHandler)

  Setter for property 'sessionHandler'.

  Parameters:
    `sessionHandler` - Value to set for property 'sessionHandler'.

### workAccepted

    public void workAccepted(javax.resource.spi.work.WorkEvent event)

  Specified by:
    `workAccepted` in interface `javax.resource.spi.work.WorkListener`

### workRejected

    public void workRejected(javax.resource.spi.work.WorkEvent event)

  Specified by:
    `workRejected` in interface `javax.resource.spi.work.WorkListener`

### workStarted

    public void workStarted(javax.resource.spi.work.WorkEvent event)

  Specified by:
    `workStarted` in interface `javax.resource.spi.work.WorkListener`

### workCompleted

    public void workCompleted(javax.resource.spi.work.WorkEvent event)

  Specified by:
    `workCompleted` in interface `javax.resource.spi.work.WorkListener`

### handleWorkException

    protected void handleWorkException(javax.resource.spi.work.WorkEvent event,
                                       String type)

### setupDispatchReturn

    protected void setupDispatchReturn(OutboundEndpoint endpoint,
                                       MessageDispatcher dispatcher,
                                       MuleMessage result)

  This method will return the dispatcher to the pool or, if the payload is an inputstream, replace the payload with a new DelegatingInputStream which returns the dispatcher to the pool when the stream is closed.

  Parameters:
    `endpoint` -
    `dispatcher` -
    `result` -

### request

    public MuleMessage request(String uri,
                               long timeout)
                        throws Exception

  Description copied from interface: `Connector`
  Make a specific request to the underlying transport

  Specified by:
    `request` in interface `Connector`
  Parameters:
    `uri` - the endpoint uri to use when connecting to the resource
    `timeout` - the maximum time the operation should block before returning. The call should return immediately if there is data available. If no data becomes available before the timeout elapses, null will be returned
  Returns:
    the result of the request wrapped in a MuleMessage object. Null will be returned if no data was avaialable
  Throws:
    `Exception` - if the call to the underlying protocal cuases an exception

### request

    public MuleMessage request(InboundEndpoint endpoint,
                               long timeout)
                        throws Exception

  Description copied from interface: `Connector`
  Make a specific request to the underlying transport

  Specified by:
    `request` in interface `Connector`
  Parameters:
    `endpoint` - the endpoint to use when connecting to the resource
    `timeout` - the maximum time the operation should block before returning. The call should return immediately if there is data available. If no data becomes available before the timeout elapses, null will be returned
  Returns:
    the result of the request wrapped in a MuleMessage object. Null will be returned if no data was avaialable
  Throws:
    `Exception` - if the call to the underlying protocal cuases an exception

### setupRequestReturn

    protected void setupRequestReturn(InboundEndpoint endpoint,
                                      MessageRequester requester,
                                      MuleMessage result)

  This method will return the requester to the pool or, if the payload is an inputstream, replace the payload with a new DelegatingInputStream which returns the requester to the pool when the stream is closed.

  Parameters:
    `endpoint` -
    `requester` -
    `result` -

### initialiseFromUrl

    public void initialiseFromUrl(EndpointURI endpointUri)
                           throws InitialisationException

  When this connector is created via the `TransportFactory` the endpoint used to determine the connector type is passed to this method so that any properties set on the endpoint that can be used to initialise the connector are made available.

  Parameters:
    `endpointUri` - the `EndpointURI` use to create this connector
  Throws:
    `InitialisationException` - If there are any problems with the configuration set on the Endpoint or if another exception is thrown it is wrapped in an InitialisationException.

### initFromServiceDescriptor

    protected void initFromServiceDescriptor()
                                      throws InitialisationException

  Initialises this connector from its `TransportServiceDescriptor` This will be called before the `doInitialise()` method is called.

  Throws:
    `InitialisationException` - InitialisationException If there are any problems with the configuration or if another exception is thrown it is wrapped in an InitialisationException.

### getServiceDescriptor

    protected TransportServiceDescriptor getServiceDescriptor()

  Get the `TransportServiceDescriptor` for this connector. This will be null if the connector was created by the developer. To create a connector the proper way the developer should use the `TransportFactory` and pass in an endpoint.

  Returns:
    the `TransportServiceDescriptor` for this connector

### createReceiver

    protected MessageReceiver createReceiver(FlowConstruct flowConstruct,
                                             InboundEndpoint endpoint)
                                      throws Exception

  Create a Message receiver for this connector

  Parameters:
    `flowConstruct` - the service that will receive events from this receiver, the listener
    `endpoint` - the endpoint that defies this inbound communication
  Returns:
    an instance of the message receiver defined in this connectors' `TransportServiceDescriptor` initialised using the service and endpoint.
  Throws:
    `Exception` - if there is a problem creating the receiver. This exception really depends on the underlying transport, thus any exception could be thrown

### getServiceOverrides

    public Map getServiceOverrides()

  A map of fully qualified class names that should override those in the connectors' service descriptor This map will be null if there are no overrides

  Returns:
    a map of override values or null

### setServiceOverrides

    public void setServiceOverrides(Map serviceOverrides)

  Set the Service overrides on this connector.

  Parameters:
    `serviceOverrides` - the override values to use

### getOutputStream

    public OutputStream getOutputStream(OutboundEndpoint endpoint,
                                        MuleEvent event)
                                 throws MuleException

  Will get the output stream for this type of transport. Typically this will be called only when Streaming is being used on an outbound endpoint. If Streaming is not supported by this transport an `UnsupportedOperationException` is thrown. Note that the stream MUST release resources on close. For help doing so, see `CallbackOutputStream`.

  Specified by:
    `getOutputStream` in interface `Connector`
  Parameters:
    `endpoint` - the endpoint that releates to this Dispatcher
    `event` - the current event being processed
  Returns:
    the output stream to use for this request
  Throws:
    `MuleException` - in case of any error

### getMuleContext

    public MuleContext getMuleContext()

  Specified by:
    `getMuleContext` in interface `Connector`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getRetryPolicyTemplate

    public RetryPolicyTemplate getRetryPolicyTemplate()

  Specified by:
    `getRetryPolicyTemplate` in interface `Connector`

### setRetryPolicyTemplate

    public void setRetryPolicyTemplate(RetryPolicyTemplate retryPolicyTemplate)

### isValidateConnections

    public boolean isValidateConnections()

  Whether to test a connection on each take from pool.

### setValidateConnections

    public void setValidateConnections(boolean validateConnections)

  Whether to test a connection on each take. A result is higher availability at the expense of a potential slight performance hit (when a test connection is made) or be very lightweight in other cases (like sending a hearbeat ping to the server).

  Disable to obtain slight performance gain or if you are absolutely sure of the server availability.

  It is up to the transport implementatin to support such validation, thus it should be considered a hint only.

  The default value is `true`

### setDispatcherPoolWhenExhaustedAction

    public void setDispatcherPoolWhenExhaustedAction(byte whenExhaustedAction)

  Allows an ExhaustedAction to be configured on the dispatcher object pool See: `GenericKeyedObjectPool.setWhenExhaustedAction(byte)`

### setDispatcherPoolMaxWait

    public void setDispatcherPoolMaxWait(int maxWait)

  Allows a maxWait timeout to be configured on the dispatcher object pool See: `GenericKeyedObjectPool.setMaxWait(long)`

### setDispatcherPoolFactory

    public void setDispatcherPoolFactory(ConfigurableKeyedObjectPoolFactory dispatcherPoolFactory)

  Allows to define a factory to create the dispatchers pool that will be used in the connector

### getDispatcherPoolFactory

    public ConfigurableKeyedObjectPoolFactory getDispatcherPoolFactory()

### setRequesterPoolWhenExhaustedAction

    public void setRequesterPoolWhenExhaustedAction(byte whenExhaustedAction)

  Allows an ExhaustedAction to be configured on the requester object pool See: `GenericKeyedObjectPool.setWhenExhaustedAction(byte)`

### setRequesterPoolMaxWait

    public void setRequesterPoolMaxWait(int maxWait)

  Allows a maxWait timeout to be configured on the requester object pool See: `GenericKeyedObjectPool.setMaxWait(long)`

### createDispatcherMessageProcessor

    public MessageProcessor createDispatcherMessageProcessor(OutboundEndpoint endpoint)
                                                      throws MuleException

  Throws:
    `MuleException`

### getDefaultExchangePattern

    public MessageExchangePattern getDefaultExchangePattern()

  Specified by:
    `getDefaultExchangePattern` in interface `Connector`
  Returns:
    the default `MessageExchangePattern` as configured in the transport's service descriptor.

### getInboundExchangePatterns

    public List<MessageExchangePattern> getInboundExchangePatterns()

  Specified by:
    `getInboundExchangePatterns` in interface `Connector`
  Returns:
    List of exchange patterns that this connector supports for inbound endpoints.

### getOutboundExchangePatterns

    public List<MessageExchangePattern> getOutboundExchangePatterns()

  Specified by:
    `getOutboundExchangePatterns` in interface `Connector`
  Returns:
    List of exchange patterns that this connector supports for outbound endpoints.

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

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.