@Documented @Retention(value=RUNTIME) @Target(value=TYPE) @Scope @Introduction @Type(value=JMSProducerMethodInterceptor.class) @Bean @DefaultScope(value=javax.inject.Singleton.class) @MessageProducer public @interface JMSProducer
Queue
or Topic
, otherwise an
IllegalStateException
will be thrown.
Additionally, the value specified by the JMSProducer
must correspond
to exactly one JMSConnectionFactory
or an IllegalStateException
will be thrown.
Usage:
@JMSConnectionFactory("connectionFactoryOne") public ConnectionFactory connectionFactoryOne() { return new ActiveMqConnectionFactory("vm://localhost?broker.persist=false"); } @JMSConnectionFactory("connectionFactoryTwo") public ConnectionFactory connectionFactoryTwo() { RMQConnectionFactory connectionFactory = new RMQConnectionFactory(); connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); connectionFactory.setVirtualHost("/"); connectionFactory.setHost("localhost"); connectionFactory.setPort(5672); return connectionFactory; } @JMSProducer("connectionFactoryOne") public interface ProducerOne { @Queue("my-activemq-queue") public void send(String message) { // do logic } } @JMSProducer("connectionFactoryTwo") public interface ProducerTwo { @Queue("my-rabbitmq-queue") public void notify(Integer message) { // do logic } }
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value
Name of the
ConnectionFactory bean in the context to
use to configure the JMSListenerContainer . |
public abstract java.lang.String value
ConnectionFactory
bean in the context to
use to configure the JMSListenerContainer
.
The name must correspond to a bean annotated with JMSConnectionFactory
and the values must be the same.JMSConnectionFactory
to use