artemiscloud / activemq-artemis-operator

Apache License 2.0
64 stars 62 forks source link

How to use STOMP SUBSCRIBE frame to connect to Artemis Address #507

Closed bikathi closed 1 year ago

bikathi commented 1 year ago

Hi all, So I am learning about MOMs and were using Artemis for this. So I used jakarta.jms.* classes to create a queue destination like this:

public void createUserDestination(String userId) throws JMSException {
        destination = setupConnection().createQueue("Queue." + userId);
        producer = session.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
        producer.send(session.createTextMessage("Testing queue availability"));

        connection.close();
        log.info("successfully created group... going back to controller");
}

So if I pass a userId variable as user12345, I get a Queue with the address Queue.user12345.

PROBLEM

I am trying to connect(subscribe) to this address using a STOMP client from a simple VueJS app like this but this seems to create a new address on the MOM that looks like this /queue/Queue.user12345 and connecting to that address, completely ignoring the queue I created earlier.:

stompClient.subscribe("/queue/Queue.user12345", (message) => {
                        receivedMessages.value.push(message.body);
});

Please note that I am using instructions I read from the documentation at the ActiveMQ Documentation under the Working with Destinations with Stomp section. Could someone please show me how I am supposed to connect to my Address created with JMS before?

OTHER CONFIGS

I am connecting Artemis as my stomp relay broker like this(Spring Backend):

@Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        // these two end points are prefixes for where the messages are pushed to
        registry.enableStompBrokerRelay("/queue", "/topic")
            .setRelayHost("127.0.0.1")
            .setRelayPort(61613)
            .setSystemLogin(brokerUsername)
            .setSystemPasscode(brokerPassword)
            .setClientLogin(brokerUsername)
            .setClientPasscode(brokerPassword);

        // this prefixes the end points where clients send messages
        registry.setApplicationDestinationPrefixes("/app", "/topic", "/queue");

        // this prefixes the end points where the user's subscribe to
        registry.setUserDestinationPrefix("/user");
    }

Any help with this issue?

brusdev commented 1 year ago

@Q-T5 this seems a question for Apache ActiveMQ Artemis users mailing list users@activemq.apache.org why do you think it is related to the ArtemisCloud Operator?