Commit 84b5cbc5 authored by Nicolas Tachker's avatar Nicolas Tachker

JORAM-258: on createConsumer/Producer, add links to commit or rollback if the...

JORAM-258:  on createConsumer/Producer, add links to commit or rollback if the session context is transacted.
parent b2423278
......@@ -157,7 +157,8 @@ public class JmsService {
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_SEND);
// link send next message
long id = helper.getSessionCtx(prodId).getLastId() + 1;
SessionContext prodCtx = helper.getSessionCtx(prodId);
long id = prodCtx.getLastId() + 1;
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(""+id);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_SEND_NEXT);
......@@ -165,6 +166,16 @@ public class JmsService {
nextBuilder = UriBuilder.fromPath(uriInfo.getBaseUri().toString()).path(JMS).path(prodId);
builder.link(nextBuilder.build(), "close-" + JmsContextService.CONTEXT);
if (prodCtx.getJmsContext().getTransacted()) {
// link commit message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(JmsContextService.CONTEXT_COMMIT);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_COMMIT);
// link rollback message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(JmsContextService.CONTEXT_ROLLBACK);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_ROLLBACK);
}
return builder.build();
} finally {
JmsContextService.logLinks(builder);
......@@ -223,7 +234,8 @@ public class JmsService {
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_SEND);
// link send next message
long id = helper.getSessionCtx(prodId).getLastId() + 1;
SessionContext prodCtx = helper.getSessionCtx(prodId);
long id = prodCtx.getLastId() + 1;
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(""+id);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_SEND_NEXT);
......@@ -231,6 +243,16 @@ public class JmsService {
nextBuilder = UriBuilder.fromPath(uriInfo.getBaseUri().toString()).path(JMS).path(prodId);
builder.link(nextBuilder.build(), "close-" + JmsContextService.CONTEXT);
if (prodCtx.getJmsContext().getTransacted()) {
// link commit message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(JmsContextService.CONTEXT_COMMIT);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_COMMIT);
// link rollback message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(JmsContextService.CONTEXT_ROLLBACK);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_ROLLBACK);
}
return builder.build();
} finally {
JmsContextService.logLinks(builder);
......@@ -288,7 +310,8 @@ public class JmsService {
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_CONSUME);
// link consume next message
long id = helper.getSessionCtx(consId).getLastId() + 1;
SessionContext consCtx = helper.getSessionCtx(consId);
long id = consCtx.getLastId() + 1;
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(""+id);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_CONSUME_NEXT);
......@@ -296,6 +319,15 @@ public class JmsService {
nextBuilder = UriBuilder.fromPath(uriInfo.getBaseUri().toString()).path(JMS).path(consId);
builder.link(nextBuilder.build(), "close-" + JmsContextService.CONTEXT);
if (consCtx.getJmsContext().getTransacted()) {
// link commit consumer message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(JmsContextService.CONTEXT_COMMIT);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_COMMIT);
// link rollback consumer message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(JmsContextService.CONTEXT_ROLLBACK);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_ROLLBACK);
}
return builder.build();
} finally {
JmsContextService.logLinks(builder);
......@@ -354,13 +386,24 @@ public class JmsService {
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_CONSUME);
// link consume next message
long id = helper.getSessionCtx(consId).getLastId() + 1;
SessionContext consCtx = helper.getSessionCtx(consId);
long id = consCtx.getLastId() + 1;
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(""+id);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_CONSUME_NEXT);
// link delete consumer
nextBuilder = UriBuilder.fromPath(uriInfo.getBaseUri().toString()).path(JMS).path(consId);
builder.link(nextBuilder.build(), "close-" + JmsContextService.CONTEXT);
if (consCtx.getJmsContext().getTransacted()) {
// link commit consumer message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(JmsContextService.CONTEXT_COMMIT);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_COMMIT);
// link rollback consumer message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(JmsContextService.CONTEXT_ROLLBACK);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_ROLLBACK);
}
return builder.build();
} finally {
......
......@@ -242,7 +242,8 @@ public class JndiService {
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_SEND);
// link send next message
long id = helper.getSessionCtx(prodId).getLastId() + 1;
SessionContext prodCtx = helper.getSessionCtx(prodId);
long id = prodCtx.getLastId() + 1;
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(""+id);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_SEND_NEXT);
......@@ -250,6 +251,16 @@ public class JndiService {
nextBuilder = UriBuilder.fromPath(uriInfo.getBaseUri().toString()).path(JmsService.JMS).path(prodId);
builder.link(nextBuilder.build(), "close-" + JmsContextService.CONTEXT);
if (prodCtx.getJmsContext().getTransacted()) {
// link commit message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(JmsContextService.CONTEXT_COMMIT);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_COMMIT);
// link rollback message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(prodId).path(JmsContextService.CONTEXT_ROLLBACK);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_ROLLBACK);
}
return builder.build();
} finally {
JmsContextService.logLinks(builder);
......@@ -311,7 +322,8 @@ public class JndiService {
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_CONSUME);
// link consume next message
long id = helper.getSessionCtx(consId).getLastId() + 1;
SessionContext consCtx = helper.getSessionCtx(consId);
long id = consCtx.getLastId() + 1;
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(""+id);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_CONSUME_NEXT);
......@@ -319,6 +331,16 @@ public class JndiService {
nextBuilder = UriBuilder.fromPath(uriInfo.getBaseUri().toString()).path(JmsService.JMS).path(consId);
builder.link(nextBuilder.build(), "close-" + JmsContextService.CONTEXT);
if (consCtx.getJmsContext().getTransacted()) {
// link commit consumer message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(JmsContextService.CONTEXT_COMMIT);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_COMMIT);
// link rollback consumer message
nextBuilder = UriBuilder.fromUri(uriInfo.getBaseUri()).path(JmsContextService.CONTEXT).path(consId).path(JmsContextService.CONTEXT_ROLLBACK);
builder.link(nextBuilder.build(), JmsContextService.CONTEXT_ROLLBACK);
}
return builder.build();
} finally {
JmsContextService.logLinks(builder);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment