use of com.swiftmq.jms.smqp.v750.CreateSessionRequest in project swiftmq-client by iitsoftware.
the class TopicConnectionImpl method createTopicSession.
public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException {
verifyState();
SessionImpl topicSession = null;
CreateSessionReply reply = null;
try {
reply = (CreateSessionReply) requestRegistry.request(new CreateSessionRequest(0, transacted, acknowledgeMode, CreateSessionRequest.TOPIC_SESSION));
} catch (Exception e) {
throw ExceptionConverter.convert(e);
}
if (reply.isOk()) {
int dispatchId = reply.getSessionDispatchId();
String cid = clientID != null ? clientID : internalCID;
topicSession = new SessionImpl(SessionImpl.TYPE_TOPIC_SESSION, this, transacted, acknowledgeMode, dispatchId, requestRegistry, myHostname, cid);
topicSession.setUserName(userName);
topicSession.setMyDispatchId(addRequestService(topicSession));
addSession(topicSession);
} else {
throw ExceptionConverter.convert(reply.getException());
}
return (topicSession);
}
use of com.swiftmq.jms.smqp.v750.CreateSessionRequest in project java-spanner by googleapis.
the class GapicSpannerRpc method createSession.
@Override
public Session createSession(String databaseName, @Nullable Map<String, String> labels, @Nullable Map<Option, ?> options) throws SpannerException {
CreateSessionRequest.Builder requestBuilder = CreateSessionRequest.newBuilder().setDatabase(databaseName);
if (labels != null && !labels.isEmpty()) {
Session.Builder session = Session.newBuilder().putAllLabels(labels);
requestBuilder.setSession(session);
}
CreateSessionRequest request = requestBuilder.build();
GrpcCallContext context = newCallContext(options, databaseName, request, SpannerGrpc.getCreateSessionMethod());
return get(spannerStub.createSessionCallable().futureCall(request, context));
}
use of com.swiftmq.jms.smqp.v750.CreateSessionRequest in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerIntegrationTest method testCreateAndGetSessionBlocking.
@Test
public void testCreateAndGetSessionBlocking() throws Exception {
SpannerBlockingStub stub = getSpannerBlockingStub();
CreateSessionRequest req = CreateSessionRequest.newBuilder().setDatabase(DATABASE_PATH).build();
// The first MAX_CHANNEL requests (without affinity) should be distributed 1 per channel.
List<Session> sessions = new ArrayList<>();
for (int i = 0; i < MAX_CHANNEL; i++) {
Session session = stub.createSession(req);
assertThat(session).isNotEqualTo(null);
sessions.add(session);
Session responseGet = stub.getSession(GetSessionRequest.newBuilder().setName(session.getName()).build());
assertEquals(responseGet.getName(), session.getName());
}
checkChannelRefs(MAX_CHANNEL, 0, 1);
for (Session session : sessions) {
deleteSession(stub, session);
}
checkChannelRefs(MAX_CHANNEL, 0, 0);
}
use of com.swiftmq.jms.smqp.v750.CreateSessionRequest in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerIntegrationTest method testBoundAfterUnbind.
@Test
public void testBoundAfterUnbind() {
SpannerBlockingStub stub = getSpannerBlockingStub();
CreateSessionRequest req = CreateSessionRequest.newBuilder().setDatabase(DATABASE_PATH).build();
Session session = stub.createSession(req);
stub.deleteSession(DeleteSessionRequest.newBuilder().setName(session.getName()).build());
expectedEx.expect(StatusRuntimeException.class);
expectedEx.expectMessage("NOT_FOUND: Session not found: " + session.getName());
stub.getSession(GetSessionRequest.newBuilder().setName(session.getName()).build());
}
use of com.swiftmq.jms.smqp.v750.CreateSessionRequest in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerLoadTest method createFutureSessions.
private static List<String> createFutureSessions(SpannerFutureStub stub) throws ExecutionException, InterruptedException {
List<ListenableFuture<Session>> futures = new ArrayList<>();
List<String> futureNames = new ArrayList<>();
// Check CreateSession with multiple channels and streams,
CreateSessionRequest req = CreateSessionRequest.newBuilder().setDatabase(DATABASE).build();
for (int i = 0; i < MAX_CHANNEL * MAX_STREAM / 2; i++) {
ListenableFuture<Session> future = stub.createSession(req);
futures.add(future);
}
for (ListenableFuture<Session> future : futures) {
futureNames.add(future.get().getName());
}
return futureNames;
}
Aggregations