Pavlo Zvarych
Pavlo Zvarych

Reputation: 645

Artemis apps don't hear each other

My apps have spring-boot-starter-artemis dependency with 1.5.8 version. External Artemis server uses 2.6.0. One app is publishing messages to the address: tacocloud.order.queue:

@Configuration
public class ApplicationConfiguration {

    @Bean
    public Destination orderQueue() {
        return new ActiveMQQueue("tacocloud.order.queue");
    }

}

Service layer of the first app:

@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class JmsOrderMessagingService implements OrderMessagingService {

    private final JmsTemplate jmsTemplate;

    private final Destination destination;

    @Override
    public void sendOrder(Order order) {
        jmsTemplate.send(destination, session -> {
            Message message = session.createObjectMessage(order);
            message.setStringProperty("X_ORDER_SOURCE", "WEB");
            return message;
        });
    }

}

Second app is listening on the address: tacocloud.order.queue

@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderReceiver {

    private final JmsTemplate jmsTemplate;

    @GetMapping("/new/message")
    public Message receiveOrder() {
        return jmsTemplate.receive("tacocloud.order.queue");
    }

}

Though the specified address to listen to is tacocloud.order.queue, in the Artemis Management console it is registered as jms.queue.tacocloud.order.queue.

enter image description here

Question: how to make 2 apps hear each other?

Upvotes: 0

Views: 150

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 35162

You need to either:

  1. Update your client to use the latest version of spring-boot-starter-artemis (e.g. 2.0.3.RELEASE).
  2. Update your acceptor to use anycastPrefix=jms.queue.;multicastPrefix=jms.topic.. This is noted in the Artemis documentation when upgrading from 2.4.0.

Upvotes: 1

Related Questions