[
https://issues.apache.org/jira/browse/ARTEMIS-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15858383#comment-15858383
]
Paul Gobin commented on ARTEMIS-948:
------------------------------------
Hi Justin- thanks for the quick response-
1- The browser client via SockJS
2- Confirmed, I do see the destinations in JConsole address (topics) and Queues
created correctly.
3- I am doing both, jms.topic and jms.queue.
I am using Spring Boot... reference:
https://spring.io/guides/gs/messaging-stomp-websocket/
-- My Websocket Config:
..
@Override
public void configureMessageBroker(MessageBrokerRegistry
messageBrokerRegistry)
{
messageBrokerRegistry.setApplicationDestinationPrefixes("/app");
if (UseSimpleMessagingBroker)
{
// Destination Prefix - Connect to default in-memory
broker
log.warn(
"NOTE: ***CHAT SERVICE IS CONFIGURED TO USE A
SIMPLE EMBEDDED MESSAGING BROKER. IT IS RECOMMENDED TO USE A MESSAGE BROKER
CLUSTER LIKE ActiveMQ or RabbitMQ. THIS CAN BE CONFIGURED IN
application.properties => UseSimpleMessagingBroker=false");
//AMQ or Apollo prefix
//messageBrokerRegistry.enableSimpleBroker("/topic/",
"/queue/");
//Artemis prefix
messageBrokerRegistry.enableSimpleBroker("jms.topic.",
"jms.queue.");
} else
{
// connect to AMQ
//AMQ or Apollo prefix
//StompBrokerRelayRegistration broker =
messageBrokerRegistry.enableStompBrokerRelay("/queue/", "/topic/");
//Artemis prefix
StompBrokerRelayRegistration broker =
messageBrokerRegistry.enableStompBrokerRelay("jms.queue.", "jms.topic.");
broker.setRelayHost(StompBrokerRelayHost);
broker.setRelayPort(StompBrokerRelayPort);
broker.setSystemLogin(brokerUser);
broker.setSystemPasscode(brokerPassword);
broker.setClientLogin(stompClientUser);
broker.setClientPasscode(stompClientPassword);
// broker.setVirtualHost(virtualHost)
}
}
and my controller that receive messages from the Browser UI and responding on
the destination:
...
@MessageMapping(ChatConstants.BASE_MESSAGE_MAPPING +
"RequestChatConversationV2")
public void requestChatConversationV2(
RequestChatLog req /* , @Headers MessageHeaders headers */)
throws Exception
{
// Object replyTo = headers.get("nativeHeaders");
long toUserID = req.getToUserid();
long fromUserid = req.getFromUserid();
String respondOnQueue = req.getResponseQueue();
long startRetrieve = System.currentTimeMillis();
log.info("REQUESTING P2P Chats from MongoDB " + fromUserid + "
for " + toUserID);
ChatMessageList cml =
chatMessageDAO.requestChatConversation(req);
ChatMessagePayload cmp =
ChatMessagePayload.getChatMessagePayload(cml.getChatMessages());
cmp.setPageNumber(cml.getPageNumber());
cmp.setPageSize(cml.getPageSize());
cmp.setTotalPages(cml.getTotalPages());
String queue = ChatConstants.BASE_DESTINATION_QUEUE +
respondOnQueue;
Map<String, Object> headers = new HashMap<>();
headers.put("userid", fromUserid);
this.template.convertAndSend(queue, cmp, headers);
long doneRetrieveing = System.currentTimeMillis();
log.info("[STATS] TIME TO RETRIEVE AND PUSH P2P CHAT
CONVERSATIONS FROM MONGODB TO THE UI [FROM USER:" + fromUserid + " TO USER: " +
toUserID
+ " IS " + (doneRetrieveing - startRetrieve) + "]");
}
..
---
This is in the browser console:
subscription:sub-43
message-id:3053
destination:jms.queue.osportal.chat.DEV.chat_log_response_queue_172034_32a82fe4-4b3e-49a9-8dec-96d6da6cc58e
expires:0
redelivered:false
priority:4
persistent:false
timestamp:1486573797923
content-type:application/json;charset=UTF-8
userid:172034
content-length:2350
and this in my server log:
responding on
jms.queue.osportal.chat.DEV.chat_log_response_queue_172034_32a82fe4-4b3e-49a9-8dec-96d6da6cc58e
-----------------------------------------------------------------
UPDATE:
I tested this code once more to reproduce the issues and it seem to be working
now-
If I find any further issues I will update this thread.
Thanks
> SockJS clients are not receiving messages when published to queues
> ------------------------------------------------------------------
>
> Key: ARTEMIS-948
> URL: https://issues.apache.org/jira/browse/ARTEMIS-948
> Project: ActiveMQ Artemis
> Issue Type: Task
> Components: Stomp
> Affects Versions: 1.5.2
> Environment: Reference to
> http://stackoverflow.com/questions/31688222/best-way-to-automatically-add-stomp-native-headers-to-headers
> When sending messages to dynamically created destinations example
> jms.queue.osportal.chat.DEV.userListOnline, the expected behavior is that the
> Stomp over SockJS browser client should receive the message since they are
> subscribed to said destination. Using JConsole, the destination is not listed
> and the browser client is not receiving the messages, works with ActiveMQ and
> Apollo except the predicate used for ActiveMQ and Apollo is /topic/ and
> /topic/
> Reporter: Paul Gobin
> Priority: Minor
>
> When sending messages to dynamically created destinations example
> jms.queue.osportal.chat.DEV.userListOnline, the expected behavior is that the
> Stomp over SockJS browser client should receive the message since they are
> subscribed to said destination. Using JConsole, the destination is not listed
> and the browser client is not receiving the messages, works with ActiveMQ and
> Apollo except the predicate used for ActiveMQ and Apollo is /topic/ and
> /queue/
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)