org.apache.servicemix.jbi.messaging
Class DeliveryChannelImpl

java.lang.Object
  extended by org.apache.servicemix.jbi.messaging.DeliveryChannelImpl
All Implemented Interfaces:
javax.jbi.messaging.DeliveryChannel

public class DeliveryChannelImpl
extends Object
implements javax.jbi.messaging.DeliveryChannel

DeliveryChannel implementation

Version:
$Revision: 695373 $

Constructor Summary
DeliveryChannelImpl(ComponentMBeanImpl component)
          Constructor
 
Method Summary
 javax.jbi.messaging.MessageExchange accept()
           
 javax.jbi.messaging.MessageExchange accept(long timeoutMS)
          return a MessageExchange
protected  void autoEnlistInTx(MessageExchangeImpl me)
          If the jbi container configured to do so, the message exchange will automatically be enlisted in the current transaction, if exists.
protected  void autoSetPersistent(MessageExchangeImpl me)
           
 void cancelPendingExchanges()
          Cancel all pending exchanges currently being handled by the DeliveryChannel
protected  void checkNotClosed()
           
 void close()
          close the delivery channel
 javax.jbi.messaging.MessageExchangeFactory createExchangeFactory()
          Create a message exchange factory.
 javax.jbi.messaging.MessageExchangeFactory createExchangeFactory(QName interfaceName)
          Create a message exchange factory for the given interface name.
 javax.jbi.messaging.MessageExchangeFactory createExchangeFactory(javax.jbi.servicedesc.ServiceEndpoint endpoint)
          Create a message exchange factory for the given endpoint.
 javax.jbi.messaging.MessageExchangeFactory createExchangeFactoryForService(QName serviceName)
          Create a message exchange factory for the given service name.
protected  MessageExchangeFactoryImpl createMessageExchangeFactory()
           
protected  void doSend(MessageExchangeImpl me, boolean sync)
           
 ComponentMBeanImpl getComponent()
           
 JBIContainer getContainer()
           
 ComponentContextImpl getContext()
          Get the context
protected  MessageExchangeListener getExchangeListener()
           
 javax.jbi.messaging.MessageExchangeFactory getInboundFactory()
          Get Inbound Factory
 int getQueueSize()
           
protected  void notifyExchange(MessageExchangeImpl me, Object lock, String from)
           
 void processInBound(MessageExchangeImpl me)
          Used internally for passing in a MessageExchange
protected  void resumeTx(MessageExchangeImpl me)
           
 void send(javax.jbi.messaging.MessageExchange messageExchange)
          routes a MessageExchange
 boolean sendSync(javax.jbi.messaging.MessageExchange messageExchange)
          routes a MessageExchange
 boolean sendSync(javax.jbi.messaging.MessageExchange messageExchange, long timeout)
          routes a MessageExchange
 void setContainer(JBIContainer container)
           
 void setContext(ComponentContextImpl context)
          set the context
protected  void suspendTx(MessageExchangeImpl me)
           
protected  void throttle()
           
 String toString()
           
protected  void waitForExchange(MessageExchangeImpl me, Object lock, long timeout, String from)
          Synchronization must be performed on the given exchange when calling this method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeliveryChannelImpl

public DeliveryChannelImpl(ComponentMBeanImpl component)
Constructor

Method Detail

getQueueSize

public int getQueueSize()
Returns:
size of the inbound Queue

close

public void close()
           throws javax.jbi.messaging.MessagingException
close the delivery channel

Specified by:
close in interface javax.jbi.messaging.DeliveryChannel
Throws:
javax.jbi.messaging.MessagingException

checkNotClosed

protected void checkNotClosed()
                       throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

createExchangeFactory

public javax.jbi.messaging.MessageExchangeFactory createExchangeFactory()
Create a message exchange factory. This factory will create exchange instances with all appropriate properties set to null.

Specified by:
createExchangeFactory in interface javax.jbi.messaging.DeliveryChannel
Returns:
a message exchange factory

createExchangeFactory

public javax.jbi.messaging.MessageExchangeFactory createExchangeFactory(QName interfaceName)
Create a message exchange factory for the given interface name.

Specified by:
createExchangeFactory in interface javax.jbi.messaging.DeliveryChannel
Parameters:
interfaceName - name of the interface for which all exchanges created by the returned factory will be set
Returns:
an exchange factory that will create exchanges for the given interface; must be non-null

createExchangeFactoryForService

public javax.jbi.messaging.MessageExchangeFactory createExchangeFactoryForService(QName serviceName)
Create a message exchange factory for the given service name.

Specified by:
createExchangeFactoryForService in interface javax.jbi.messaging.DeliveryChannel
Parameters:
serviceName - name of the service for which all exchanges created by the returned factory will be set
Returns:
an exchange factory that will create exchanges for the given service; must be non-null

createExchangeFactory

public javax.jbi.messaging.MessageExchangeFactory createExchangeFactory(javax.jbi.servicedesc.ServiceEndpoint endpoint)
Create a message exchange factory for the given endpoint.

Specified by:
createExchangeFactory in interface javax.jbi.messaging.DeliveryChannel
Parameters:
endpoint - endpoint for which all exchanges created by the returned factory will be set for
Returns:
an exchange factory that will create exchanges for the given endpoint

createMessageExchangeFactory

protected MessageExchangeFactoryImpl createMessageExchangeFactory()

accept

public javax.jbi.messaging.MessageExchange accept()
                                           throws javax.jbi.messaging.MessagingException
Specified by:
accept in interface javax.jbi.messaging.DeliveryChannel
Returns:
a MessageExchange - blocking call
Throws:
javax.jbi.messaging.MessagingException

accept

public javax.jbi.messaging.MessageExchange accept(long timeoutMS)
                                           throws javax.jbi.messaging.MessagingException
return a MessageExchange

Specified by:
accept in interface javax.jbi.messaging.DeliveryChannel
Parameters:
timeoutMS -
Returns:
Message Exchange
Throws:
javax.jbi.messaging.MessagingException

autoSetPersistent

protected void autoSetPersistent(MessageExchangeImpl me)

throttle

protected void throttle()

doSend

protected void doSend(MessageExchangeImpl me,
                      boolean sync)
               throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

send

public void send(javax.jbi.messaging.MessageExchange messageExchange)
          throws javax.jbi.messaging.MessagingException
routes a MessageExchange

Specified by:
send in interface javax.jbi.messaging.DeliveryChannel
Parameters:
messageExchange -
Throws:
javax.jbi.messaging.MessagingException

sendSync

public boolean sendSync(javax.jbi.messaging.MessageExchange messageExchange)
                 throws javax.jbi.messaging.MessagingException
routes a MessageExchange

Specified by:
sendSync in interface javax.jbi.messaging.DeliveryChannel
Parameters:
messageExchange -
Returns:
true if processed
Throws:
javax.jbi.messaging.MessagingException

sendSync

public boolean sendSync(javax.jbi.messaging.MessageExchange messageExchange,
                        long timeout)
                 throws javax.jbi.messaging.MessagingException
routes a MessageExchange

Specified by:
sendSync in interface javax.jbi.messaging.DeliveryChannel
Parameters:
messageExchange -
timeout -
Returns:
true if processed
Throws:
javax.jbi.messaging.MessagingException

getContainer

public JBIContainer getContainer()
Returns:
Returns the container.

setContainer

public void setContainer(JBIContainer container)
Parameters:
container - The container to set.

getComponent

public ComponentMBeanImpl getComponent()
Returns:
Returns the componentConnector.

getContext

public ComponentContextImpl getContext()
Get the context

Returns:
the context

setContext

public void setContext(ComponentContextImpl context)
set the context

Parameters:
context -

processInBound

public void processInBound(MessageExchangeImpl me)
                    throws javax.jbi.messaging.MessagingException
Used internally for passing in a MessageExchange

Parameters:
me -
Throws:
javax.jbi.messaging.MessagingException

getExchangeListener

protected MessageExchangeListener getExchangeListener()

waitForExchange

protected void waitForExchange(MessageExchangeImpl me,
                               Object lock,
                               long timeout,
                               String from)
                        throws InterruptedException
Synchronization must be performed on the given exchange when calling this method

Parameters:
me -
Throws:
InterruptedException

notifyExchange

protected void notifyExchange(MessageExchangeImpl me,
                              Object lock,
                              String from)

getInboundFactory

public javax.jbi.messaging.MessageExchangeFactory getInboundFactory()
Get Inbound Factory

Returns:
the inbound message factory

suspendTx

protected void suspendTx(MessageExchangeImpl me)

resumeTx

protected void resumeTx(MessageExchangeImpl me)
                 throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

autoEnlistInTx

protected void autoEnlistInTx(MessageExchangeImpl me)
                       throws javax.jbi.messaging.MessagingException
If the jbi container configured to do so, the message exchange will automatically be enlisted in the current transaction, if exists.

Throws:
javax.jbi.messaging.MessagingException

toString

public String toString()
Overrides:
toString in class Object
Returns:
pretty print

cancelPendingExchanges

public void cancelPendingExchanges()
Cancel all pending exchanges currently being handled by the DeliveryChannel



Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.