Annotation Interface JMSProducer


@Documented @Retention(RUNTIME) @Target(TYPE) @Scope @Introduction @Type(JMSProducerMethodInterceptor.class) @Bean @DefaultScope(jakarta.inject.Singleton.class) @MessageProducer public @interface JMSProducer
Declares a class for post-processing. Annotated classes must contain at least one method annotated with 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
      }
 }
 
Since:
1.0.0
Author:
Elliott Pope
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of the ConnectionFactory bean in the context to use to configure the JMSListener.