flex.messaging.services.messaging.adapters
Class JMSAdapter

java.lang.Object
  extended by flex.management.ManageableComponent
      extended by flex.messaging.services.ServiceAdapter
          extended by flex.messaging.services.messaging.adapters.MessagingAdapter
              extended by flex.messaging.services.messaging.adapters.JMSAdapter
All Implemented Interfaces:
Manageable, FlexComponent, FlexConfigurable, MessageClientListener, MessagingSecurity, JMSExceptionListener, JMSMessageListener, EventListener

public class JMSAdapter
extends MessagingAdapter
implements JMSExceptionListener, JMSMessageListener, MessageClientListener

This adapter for the MessageService integrates Flex messaging with Java Message Service destinations.


Field Summary
static String LOG_CATEGORY
           
 
Constructor Summary
JMSAdapter()
          Constructs an unmanaged JMSAdapter instance.
JMSAdapter(boolean enableManagement)
          Constructs a JMSAdapter instance.
 
Method Summary
 void exceptionThrown(JMSExceptionEvent evt)
          Implements JMSExceptionListener.
 JMSSettings getJMSSettings()
          Gets the JMSSettings of the JMSAdapter.
 int getQueueConsumerCount()
          Returns the count of queue consumers managed by this adapter.
 String[] getQueueConsumerIds()
          Returns the ids of all queue consumers.
 int getQueueProducerCount()
          Returns the count of queue producers currently managed by this adapter.
 int getTopicConsumerCount()
          Returns the count of topic consumers currently managed by this adapter.
 String[] getTopicConsumerIds()
          Returns the ids of all topic consumers.
 int getTopicProducerCount()
          Returns the count of topic producers currently managed by this adapter.
 boolean handlesSubscriptions()
          JMS adapter handles its subscriptions so this returns true.
 void initialize(String id, ConfigMap properties)
          Initializes the JMSAdapter with the properties.
 Object invoke(Message message)
          Publish a message to this adapter's JMS destination.
 Object manage(CommandMessage commandMessage)
          Handle a CommandMessage sent by this adapter's service.
 void messageClientCreated(MessageClient messageClient)
          Implements MessageClientListener.
 void messageClientDestroyed(MessageClient messageClient)
          Implements MessageClientListener.
 void messageReceived(JMSMessageEvent evt)
          Implements JMSMessageListener.
 void removeConsumer(String clientId)
          Removes (unsubscribes) the specified consumer.
 void setDestination(Destination destination)
          Casts the Destination into MessageDestination and calls super.setDestination.
 void setJMSSettings(JMSSettings jmsSettings)
          Sets the JMSSettings of the JMSAdapter.
 void start()
          Starts the adapter.
 void stop()
          Stops the adapter.
 
Methods inherited from class flex.messaging.services.messaging.adapters.MessagingAdapter
allowSend, allowSubscribe, getSecurityConstraintManager, setSecurityConstraintManager
 
Methods inherited from class flex.messaging.services.ServiceAdapter
getAdapterState, getDestination, setAdapterState
 
Methods inherited from class flex.management.ManageableComponent
getControl, getId, getParent, isManaged, isStarted, isValid, setControl, setId, setManaged, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_CATEGORY

public static final String LOG_CATEGORY
See Also:
Constant Field Values
Constructor Detail

JMSAdapter

public JMSAdapter()
Constructs an unmanaged JMSAdapter instance.


JMSAdapter

public JMSAdapter(boolean enableManagement)
Constructs a JMSAdapter instance.

Parameters:
enableManagement - true if the JMSAdapter has a corresponding MBean control for management; otherwise false.
Method Detail

initialize

public void initialize(String id,
                       ConfigMap properties)
Initializes the JMSAdapter with the properties.

Specified by:
initialize in interface FlexConfigurable
Overrides:
initialize in class MessagingAdapter
Parameters:
id - The id of the JMSAdapter.
properties - Properties for the JMSAdapter.

start

public void start()
Starts the adapter.

Specified by:
start in interface FlexComponent
Overrides:
start in class ServiceAdapter

stop

public void stop()
Stops the adapter.

Specified by:
stop in interface FlexComponent
Overrides:
stop in class ServiceAdapter

setDestination

public void setDestination(Destination destination)
Casts the Destination into MessageDestination and calls super.setDestination.

Overrides:
setDestination in class ServiceAdapter
Parameters:
destination - The destination of the adapter.

getJMSSettings

public JMSSettings getJMSSettings()
Gets the JMSSettings of the JMSAdapter.

Returns:
JMSSettings of the JMSAdapter.

setJMSSettings

public void setJMSSettings(JMSSettings jmsSettings)
Sets the JMSSettings of the JMSAdapter.

Parameters:
jmsSettings - JMSSettings of the JMSAdapter.

getQueueConsumerCount

public int getQueueConsumerCount()
Returns the count of queue consumers managed by this adapter.

Returns:
The count of queue consumers managed by this adapter.

getQueueConsumerIds

public String[] getQueueConsumerIds()
Returns the ids of all queue consumers.

Returns:
The ids of all queue consumers.

getTopicConsumerCount

public int getTopicConsumerCount()
Returns the count of topic consumers currently managed by this adapter.

Returns:
The count of topic consumers currently managed by this adapter.

getTopicConsumerIds

public String[] getTopicConsumerIds()
Returns the ids of all topic consumers.

Returns:
The ids of all topic consumers.

getTopicProducerCount

public int getTopicProducerCount()
Returns the count of topic producers currently managed by this adapter.

Returns:
The count of topic producers currently managed by this adapter.

getQueueProducerCount

public int getQueueProducerCount()
Returns the count of queue producers currently managed by this adapter.

Returns:
The count of queue producers currently managed by this adapter.

exceptionThrown

public void exceptionThrown(JMSExceptionEvent evt)
Implements JMSExceptionListener. When a JMSConsumer receives a JMS exception from its underlying JMS connection, it dispatches a JMS exception event to pass the exception to the JMS adapter.

Specified by:
exceptionThrown in interface JMSExceptionListener
Parameters:
evt - The JMSExceptionEvent.

handlesSubscriptions

public boolean handlesSubscriptions()
JMS adapter handles its subscriptions so this returns true.

Overrides:
handlesSubscriptions in class ServiceAdapter
Returns:
true.

invoke

public Object invoke(Message message)
Publish a message to this adapter's JMS destination.

Specified by:
invoke in class ServiceAdapter
Parameters:
message - The Flex message to publish.
Returns:
The body of the acknowledge message which is null is this case.
See Also:
Message, AsyncMessage

manage

public Object manage(CommandMessage commandMessage)
Handle a CommandMessage sent by this adapter's service.

Overrides:
manage in class ServiceAdapter
Parameters:
commandMessage - The command message to manage.
Returns:
The result of manage which is null in this case.
See Also:
CommandMessage, AsyncMessage

messageClientCreated

public void messageClientCreated(MessageClient messageClient)
Implements MessageClientListener. When a MessageClient is created, JMSAdapter looks up its JMSConsumers and if there is a JMSConsumer that has the same clientId as MessageClient, it adds the MessageClient to its list clients. This helps in keeping both sides of the bridge (MessageClient <--> JMSConsumer) notified when there's a failure on either side of the bridge.

Specified by:
messageClientCreated in interface MessageClientListener
Parameters:
messageClient - The newly created MessageClient.

messageClientDestroyed

public void messageClientDestroyed(MessageClient messageClient)
Implements MessageClientListener. When a MessageClient is destroyed (usually due to session timeout), its corresponding JMS consumer is removed. Note that this might have already happened if the client first unsubscribes and in that case, this is a no-op.

Specified by:
messageClientDestroyed in interface MessageClientListener
Parameters:
messageClient - The MessageClient that was destroyed.

messageReceived

public void messageReceived(JMSMessageEvent evt)
Implements JMSMessageListener. When a JMSConsumer receives a JMS message, it dispatched a JMS message event to pass the message to the JMS adapter.

Specified by:
messageReceived in interface JMSMessageListener
Parameters:
evt - The JMSMessageEvent.

removeConsumer

public void removeConsumer(String clientId)
Removes (unsubscribes) the specified consumer. By default, it removes the durable subscription and pushes a generic error message to the client before MessageClient invalidation.

Parameters:
clientId - The identifier for the consumer to remove.


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/services/messaging/adapters/JMSAdapter.html