Pergunta

We have already defined the inboundConnector in our jms-context.xml as specified in http://activemq.apache.org/jms-and-jdbc-operations-in-one-transaction.html for Queue

I have defined a new inboundTopicConnector for topic and when i send a message for the topic it gives the following error java.lang.UnsupportedOperationException: A destination must be specified.

Could you please help me how to resolve the issue?

in jms-context.xml

bean id="inboundConnector" ....
property name="destinationType" value="javax.jms.Queue"

bean id="inboundTopicConnector" ...
property name="destination" value="${jms.topic}"
property name="destinationType" value="javax.jms.Topic"

in jms-context-without-inbound-listeners.xml

bean id="sendTo" ...
bean id="topic" class="org.apache.activemq.command.ActiveMQTopic"
property name="physicalName" value="${jms.topic}"

in java file

@Autowired
  @Qualifier("topic")
  private Destination destination;
          getJMSTemplate().setPubSubDomain(true);
          getJMSTemplate().send(this.destination, new MessageCreator() {
            @Override
            public Message createMessage(Session session) throws JMSException {
              return session.createTextMessage("Hello...." + destination);
            }
          });

Thanks, Kathir

Foi útil?

Solução

Whenever postinq questions like this, you must include the stack trace - and more complete configuration (for example bean "topic").

Best guess is Autowiring is not enabled - so the destination field is null. You can verify this in a debugger.

Have you included <context:annotation-config/>? That enables autowiring.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top