spring boot in memory activemq
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
add a comment |
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
Should just be able toreturn "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
add a comment |
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
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
spring spring-boot activemq
asked Nov 22 '18 at 22:02
Arya
3,085114698
3,085114698
Should just be able toreturn "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
add a comment |
Should just be able toreturn "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
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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