Skip to content

Commit

Permalink
Merge pull request #1027 from middagj/jms-context
Browse files Browse the repository at this point in the history
Use JMSContext for session mode
  • Loading branch information
gastaldi authored Dec 24, 2021
2 parents 75edd97 + ff3e5eb commit 95ebc9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions jms-quickstart/src/main/java/org/acme/jms/PriceConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.runtime.StartupEvent;
Expand Down Expand Up @@ -43,7 +42,7 @@ void onStop(@Observes ShutdownEvent ev) {

@Override
public void run() {
try (JMSContext context = connectionFactory.createContext(Session.AUTO_ACKNOWLEDGE)) {
try (JMSContext context = connectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE)) {
JMSConsumer consumer = context.createConsumer(context.createQueue("prices"));
while (true) {
Message message = consumer.receive();
Expand Down
3 changes: 1 addition & 2 deletions jms-quickstart/src/main/java/org/acme/jms/PriceProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import javax.inject.Inject;
import javax.jms.ConnectionFactory;
import javax.jms.JMSContext;
import javax.jms.Session;

import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.runtime.StartupEvent;
Expand All @@ -37,7 +36,7 @@ void onStop(@Observes ShutdownEvent ev) {

@Override
public void run() {
try (JMSContext context = connectionFactory.createContext(Session.AUTO_ACKNOWLEDGE)) {
try (JMSContext context = connectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE)) {
context.createProducer().send(context.createQueue("prices"), Integer.toString(random.nextInt(100)));
}
}
Expand Down

0 comments on commit 95ebc9e

Please sign in to comment.