spring boot in memory activemq












0














I used this guide to make a simple Spring boot in-memory ActiveMQ service that takes a message from a rest controller then passes it to a listener. Then the listener does some processing which takes about 40 seconds, but I have no way of retrieving the result after it was processed.



https://github.com/TechPrimers/inmemory-spring-boot-activemq-example



Everything is working as expected so far, but I want to be able to retrieve the results the listener has processed.



One way I am thinking about doing this is by creating another rest controller that returns the result of the task the listener finished. And by using a relational database to manage the IDs and messages.



However I would rather use everything in memory and not deal with a database.



Does ActiveMQ and/or spring have anything built in for managing that?










share|improve this question






















  • Should just be able to return "hello there!" or any valid result from your listener Class/method.
    – Randy Casburn
    Nov 22 '18 at 22:27










  • @RandyCasburn yea, but I want to return what was processed in the queue. So I need to have an ID to check on the status and to get the result
    – Arya
    Nov 23 '18 at 1:19


















0














I used this guide to make a simple Spring boot in-memory ActiveMQ service that takes a message from a rest controller then passes it to a listener. Then the listener does some processing which takes about 40 seconds, but I have no way of retrieving the result after it was processed.



https://github.com/TechPrimers/inmemory-spring-boot-activemq-example



Everything is working as expected so far, but I want to be able to retrieve the results the listener has processed.



One way I am thinking about doing this is by creating another rest controller that returns the result of the task the listener finished. And by using a relational database to manage the IDs and messages.



However I would rather use everything in memory and not deal with a database.



Does ActiveMQ and/or spring have anything built in for managing that?










share|improve this question






















  • Should just be able to return "hello there!" or any valid result from your listener Class/method.
    – Randy Casburn
    Nov 22 '18 at 22:27










  • @RandyCasburn yea, but I want to return what was processed in the queue. So I need to have an ID to check on the status and to get the result
    – Arya
    Nov 23 '18 at 1:19
















0












0








0







I used this guide to make a simple Spring boot in-memory ActiveMQ service that takes a message from a rest controller then passes it to a listener. Then the listener does some processing which takes about 40 seconds, but I have no way of retrieving the result after it was processed.



https://github.com/TechPrimers/inmemory-spring-boot-activemq-example



Everything is working as expected so far, but I want to be able to retrieve the results the listener has processed.



One way I am thinking about doing this is by creating another rest controller that returns the result of the task the listener finished. And by using a relational database to manage the IDs and messages.



However I would rather use everything in memory and not deal with a database.



Does ActiveMQ and/or spring have anything built in for managing that?










share|improve this question













I used this guide to make a simple Spring boot in-memory ActiveMQ service that takes a message from a rest controller then passes it to a listener. Then the listener does some processing which takes about 40 seconds, but I have no way of retrieving the result after it was processed.



https://github.com/TechPrimers/inmemory-spring-boot-activemq-example



Everything is working as expected so far, but I want to be able to retrieve the results the listener has processed.



One way I am thinking about doing this is by creating another rest controller that returns the result of the task the listener finished. And by using a relational database to manage the IDs and messages.



However I would rather use everything in memory and not deal with a database.



Does ActiveMQ and/or spring have anything built in for managing that?







spring spring-boot activemq






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 22:02









Arya

3,085114698




3,085114698












  • Should just be able to return "hello there!" or any valid result from your listener Class/method.
    – Randy Casburn
    Nov 22 '18 at 22:27










  • @RandyCasburn yea, but I want to return what was processed in the queue. So I need to have an ID to check on the status and to get the result
    – Arya
    Nov 23 '18 at 1:19




















  • Should just be able to return "hello there!" or any valid result from your listener Class/method.
    – Randy Casburn
    Nov 22 '18 at 22:27










  • @RandyCasburn yea, but I want to return what was processed in the queue. So I need to have an ID to check on the status and to get the result
    – Arya
    Nov 23 '18 at 1:19


















Should just be able to return "hello there!" or any valid result from your listener Class/method.
– Randy Casburn
Nov 22 '18 at 22:27




Should just be able to return "hello there!" or any valid result from your listener Class/method.
– Randy Casburn
Nov 22 '18 at 22:27












@RandyCasburn yea, but I want to return what was processed in the queue. So I need to have an ID to check on the status and to get the result
– Arya
Nov 23 '18 at 1:19






@RandyCasburn yea, but I want to return what was processed in the queue. So I need to have an ID to check on the status and to get the result
– Arya
Nov 23 '18 at 1:19














1 Answer
1






active

oldest

votes


















1














What you're describing sounds to me like a request-reply pattern which is common in enterprise integration scenarios.



Assuming that the results of the work will be consumed fairly quickly then I would recommend you simply put the results into another message and send that message to a "reply" queue. The original message can include a "correlation ID" which the listener can use in the reply message as well so the results can be correlated with the request.



If the results will not be consumed fairly quickly then a database is probably better as message brokers aren't designed to be data repositories like databases are. Also, there are in-memory, embedded databases out there that would probably work well for you if you went that route.






share|improve this answer





















  • Yes, request-reply pattern is exactly what I want to do. I did read up on it. Now I'm stuck at setting correlation ID in the Spring controller. jmsTemplate has no method for doing that. I will search to see if I can find any examples.
    – Arya
    Nov 23 '18 at 2:21










  • You should be able to set the correlation ID on the message using the JMS API. See javax.jms.Message.setJMSCorrectionalID(String).
    – Justin Bertram
    Nov 23 '18 at 18:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438435%2fspring-boot-in-memory-activemq%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














What you're describing sounds to me like a request-reply pattern which is common in enterprise integration scenarios.



Assuming that the results of the work will be consumed fairly quickly then I would recommend you simply put the results into another message and send that message to a "reply" queue. The original message can include a "correlation ID" which the listener can use in the reply message as well so the results can be correlated with the request.



If the results will not be consumed fairly quickly then a database is probably better as message brokers aren't designed to be data repositories like databases are. Also, there are in-memory, embedded databases out there that would probably work well for you if you went that route.






share|improve this answer





















  • Yes, request-reply pattern is exactly what I want to do. I did read up on it. Now I'm stuck at setting correlation ID in the Spring controller. jmsTemplate has no method for doing that. I will search to see if I can find any examples.
    – Arya
    Nov 23 '18 at 2:21










  • You should be able to set the correlation ID on the message using the JMS API. See javax.jms.Message.setJMSCorrectionalID(String).
    – Justin Bertram
    Nov 23 '18 at 18:13
















1














What you're describing sounds to me like a request-reply pattern which is common in enterprise integration scenarios.



Assuming that the results of the work will be consumed fairly quickly then I would recommend you simply put the results into another message and send that message to a "reply" queue. The original message can include a "correlation ID" which the listener can use in the reply message as well so the results can be correlated with the request.



If the results will not be consumed fairly quickly then a database is probably better as message brokers aren't designed to be data repositories like databases are. Also, there are in-memory, embedded databases out there that would probably work well for you if you went that route.






share|improve this answer





















  • Yes, request-reply pattern is exactly what I want to do. I did read up on it. Now I'm stuck at setting correlation ID in the Spring controller. jmsTemplate has no method for doing that. I will search to see if I can find any examples.
    – Arya
    Nov 23 '18 at 2:21










  • You should be able to set the correlation ID on the message using the JMS API. See javax.jms.Message.setJMSCorrectionalID(String).
    – Justin Bertram
    Nov 23 '18 at 18:13














1












1








1






What you're describing sounds to me like a request-reply pattern which is common in enterprise integration scenarios.



Assuming that the results of the work will be consumed fairly quickly then I would recommend you simply put the results into another message and send that message to a "reply" queue. The original message can include a "correlation ID" which the listener can use in the reply message as well so the results can be correlated with the request.



If the results will not be consumed fairly quickly then a database is probably better as message brokers aren't designed to be data repositories like databases are. Also, there are in-memory, embedded databases out there that would probably work well for you if you went that route.






share|improve this answer












What you're describing sounds to me like a request-reply pattern which is common in enterprise integration scenarios.



Assuming that the results of the work will be consumed fairly quickly then I would recommend you simply put the results into another message and send that message to a "reply" queue. The original message can include a "correlation ID" which the listener can use in the reply message as well so the results can be correlated with the request.



If the results will not be consumed fairly quickly then a database is probably better as message brokers aren't designed to be data repositories like databases are. Also, there are in-memory, embedded databases out there that would probably work well for you if you went that route.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 '18 at 2:08









Justin Bertram

3,0171316




3,0171316












  • Yes, request-reply pattern is exactly what I want to do. I did read up on it. Now I'm stuck at setting correlation ID in the Spring controller. jmsTemplate has no method for doing that. I will search to see if I can find any examples.
    – Arya
    Nov 23 '18 at 2:21










  • You should be able to set the correlation ID on the message using the JMS API. See javax.jms.Message.setJMSCorrectionalID(String).
    – Justin Bertram
    Nov 23 '18 at 18:13


















  • Yes, request-reply pattern is exactly what I want to do. I did read up on it. Now I'm stuck at setting correlation ID in the Spring controller. jmsTemplate has no method for doing that. I will search to see if I can find any examples.
    – Arya
    Nov 23 '18 at 2:21










  • You should be able to set the correlation ID on the message using the JMS API. See javax.jms.Message.setJMSCorrectionalID(String).
    – Justin Bertram
    Nov 23 '18 at 18:13
















Yes, request-reply pattern is exactly what I want to do. I did read up on it. Now I'm stuck at setting correlation ID in the Spring controller. jmsTemplate has no method for doing that. I will search to see if I can find any examples.
– Arya
Nov 23 '18 at 2:21




Yes, request-reply pattern is exactly what I want to do. I did read up on it. Now I'm stuck at setting correlation ID in the Spring controller. jmsTemplate has no method for doing that. I will search to see if I can find any examples.
– Arya
Nov 23 '18 at 2:21












You should be able to set the correlation ID on the message using the JMS API. See javax.jms.Message.setJMSCorrectionalID(String).
– Justin Bertram
Nov 23 '18 at 18:13




You should be able to set the correlation ID on the message using the JMS API. See javax.jms.Message.setJMSCorrectionalID(String).
– Justin Bertram
Nov 23 '18 at 18:13


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438435%2fspring-boot-in-memory-activemq%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Fiat S.p.A.

Type 'String' is not a subtype of type 'int' of 'index'