org.backsource.adaptor.jms
Class Producer

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.backsource.jmx.ServiceMBeanSupport
              extended byorg.backsource.adaptor.jms.JmsBase
                  extended byorg.backsource.adaptor.jms.Producer
All Implemented Interfaces:
org.backsource.adaptor.jms.JmsBaseMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, ProducerFactory, org.backsource.adaptor.jms.ProducerMBean, org.jboss.system.Service, org.backsource.jmx.ServiceMBean, org.jboss.system.ServiceMBean

public class Producer
extends JmsBase
implements org.backsource.adaptor.jms.ProducerMBean

A JMS producer.

This class holds a connection and specific destination. Users get a MessageProducer from it. Currently this will create a session each time the getProducer is called, but it should always be left back when used, since failover handling will not work correct othervise! if given a ProducerJNDI an Mbean proxy will be bound at that name that implements ProducerFactory.

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman

Field Summary
protected  ProducerFactory prodProxy
           
protected  java.lang.String producerJNDI
           
 
Fields inherited from class org.backsource.adaptor.jms.JmsBase
ackMode, connection, connectionException, destination, exListener, failsafe, isTopic, name, OBJECT_NAME, server, stopOnFail, transacted
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, STARTED, STARTING, states, STOPPED, STOPPING
 
Constructor Summary
Producer()
           
 
Method Summary
 MessageProducer getProducer()
          Get a MessageProducer.
 java.lang.String getProducerJNDI()
           
 void leaveProducer(MessageProducer prod)
          Used by MessageProcucer to leave itself back to the factory.
 void publish(java.lang.String message)
          Publish message as a text message.
 void setProducerJNDI(java.lang.String producerJNDI)
          Set a JNDI name to bind an MBean proxy to this MBean that implements ProducerFactory.
protected  void startService()
           
protected  void stopService()
           
 
Methods inherited from class org.backsource.adaptor.jms.JmsBase
createService, destroyService, getClientId, getContext, getDestination, getDestinationFactory, getDestinationJndiName, getDestinationType, getFactory, getFailsafe, getJMSProviderAdapter, getJMSProviderAdapterJNDI, getObjectName, getPassword, getReconnectInterval, getStopOnFail, getUsername, innerCreate, innerStop, setClientId, setDestinationFactory, setDestinationJndiName, setDestinationType, setFailsafe, setJMSProviderAdapterJNDI, setPassword, setReconnectInterval, setStopOnFail, setUsername, startQueue, startTopic
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, destroy, getLog, getName, getNextNotificationSequenceNumber, getServer, getServiceName, getState, getStateString, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.backsource.adaptor.jms.JmsBaseMBean
getClientId, getDestinationFactory, getDestinationJndiName, getDestinationType, getFailsafe, getJMSProviderAdapterJNDI, getPassword, getReconnectInterval, getStopOnFail, getUsername, setClientId, setDestinationFactory, setDestinationJndiName, setDestinationType, setFailsafe, setJMSProviderAdapterJNDI, setPassword, setReconnectInterval, setStopOnFail, setUsername
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

producerJNDI

protected java.lang.String producerJNDI

prodProxy

protected ProducerFactory prodProxy
Constructor Detail

Producer

public Producer()
Method Detail

setProducerJNDI

public void setProducerJNDI(java.lang.String producerJNDI)
Set a JNDI name to bind an MBean proxy to this MBean that implements ProducerFactory.

if not set a startup, binding will not be done.

Specified by:
setProducerJNDI in interface org.backsource.adaptor.jms.ProducerMBean

getProducerJNDI

public java.lang.String getProducerJNDI()
Specified by:
getProducerJNDI in interface org.backsource.adaptor.jms.ProducerMBean

getProducer

public MessageProducer getProducer()
                            throws javax.jms.JMSException
Get a MessageProducer.

Currently a new session will be created each time this is called. Even if this is the case; the recommended usage pattern is to get it at each invokation and close it; since pooling may be introduced.

Specified by:
getProducer in interface org.backsource.adaptor.jms.ProducerMBean
Throws:
javax.jms.JMSException

leaveProducer

public void leaveProducer(MessageProducer prod)
Used by MessageProcucer to leave itself back to the factory.

Specified by:
leaveProducer in interface org.backsource.adaptor.jms.ProducerMBean

publish

public void publish(java.lang.String message)
             throws javax.jms.JMSException
Publish message as a text message.

Specified by:
publish in interface org.backsource.adaptor.jms.ProducerMBean
Throws:
javax.jms.JMSException

startService

protected void startService()
                     throws java.lang.Exception
Overrides:
startService in class JmsBase
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Overrides:
stopService in class JmsBase
Throws:
java.lang.Exception


Copyright © 2003-2004 Backsource. All Rights Reserved.