Package org.serviceconnector.scmp

Examples of org.serviceconnector.scmp.SCMPMessageSequenceNr


  @Override
  public void responseCallback(IRequest request, IResponse response) {

    SCMPMessage scmpRequest = request.getMessage();
    String sessionId = scmpRequest.getSessionId();
    SCMPMessageSequenceNr msgSequenceNr = NettyResponderRequestHandlerTask.compositeRegistry.getSCMPMsgSequenceNr(sessionId);
    if (response.isLarge() && AppContext.isScEnvironment() == false) {
      // response is large & not on SC, create a large response for reply
      SCMPCompositeSender largeResponse = new SCMPCompositeSender(response.getSCMP());
      SCMPMessage firstSCMP = largeResponse.getFirst();
      response.setSCMP(firstSCMP);
      if (SCMPMessageSequenceNr.necessaryToWrite(firstSCMP.getMessageType())) {
        // no incrementation necessary - already done inside commands
        firstSCMP.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
      }
      int oti = scmpRequest.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
      // adding compositeReceiver to the composite registry
      NettyResponderRequestHandlerTask.compositeRegistry.addSCMPLargeResponse(sessionId, largeResponse, oti);
    }
View Full Code Here


    try {
      // inform callback with scMessages
      srvService.getCallback().deleteSession(scMessage,
          Integer.parseInt(reqMessage.getHeader(SCMPHeaderAttributeKey.OPERATION_TIMEOUT)));
      // handling msgSequenceNr
      SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(sessionId);
      msgSequenceNr.incrementAndGetMsgSequenceNr();
      // set up reply
      SCMPMessage reply = new SCMPMessage();
      reply.setServiceName(serviceName);
      reply.setSessionId(reqMessage.getSessionId());
      reply.setMessageType(this.getKey());
      reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
      response.setSCMP(reply);
    } finally {
      // delete session in SCMPSessionCompositeRegistry
      SrvCommandAdapter.sessionCompositeRegistry.removeSession(sessionId);
      responderCallback.responseCallback(request, response);
View Full Code Here

    // inform callback with scMessages
    SCMessage scReply = srvService.getCallback().changeSubscription(scMessage,
        Integer.parseInt(reqMessage.getHeader(SCMPHeaderAttributeKey.OPERATION_TIMEOUT)));
    // handling msgSequenceNr
    SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(reqMessage
        .getSessionId());
    msgSequenceNr.incrementAndGetMsgSequenceNr();
    // set up reply
    SCMPMessage reply = new SCMPMessage();
    reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
    reply.setServiceName(serviceName);
    reply.setMessageType(this.getKey());

    if (scReply != null) {
      reply.setBody(scReply.getData());
View Full Code Here

    try {
      // inform callback with scMessages
      srvService.getCallback().deleteSession(scMessage,
          Integer.parseInt(reqMessage.getHeader(SCMPHeaderAttributeKey.OPERATION_TIMEOUT)));
      // handling msgSequenceNr
      SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(sessionId);
      msgSequenceNr.incrementAndGetMsgSequenceNr();
      // set up reply - SCMP Version request
      SCMPMessage reply = new SCMPMessage(reqMessage.getSCMPVersion());
      reply.setServiceName(serviceName);
      reply.setSessionId(reqMessage.getSessionId());
      reply.setMessageType(this.getKey());
      reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
      response.setSCMP(reply);
    } finally {
      // delete session in SCMPSessionCompositeRegistry
      SrvCommandAdapter.sessionCompositeRegistry.removeSession(sessionId);
      responderCallback.responseCallback(request, response);
View Full Code Here

    // inform callback with scMessages
    SCMessage scReply = srvService.getCallback().changeSubscription(scMessage,
        Integer.parseInt(reqMessage.getHeader(SCMPHeaderAttributeKey.OPERATION_TIMEOUT)));
    // handling msgSequenceNr
    SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(reqMessage
        .getSessionId());
    msgSequenceNr.incrementAndGetMsgSequenceNr();
    // set up reply - SCMP Version request
    SCMPMessage reply = new SCMPMessage(reqMessage.getSCMPVersion());
    reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
    reply.setServiceName(serviceName);
    reply.setMessageType(this.getKey());

    if (scReply != null) {
      reply.setBody(scReply.getData());
View Full Code Here

    try {
      // inform callback with scMessages
      srvService.getCallback().unsubscribe(scMessage,
          Integer.parseInt(reqMessage.getHeader(SCMPHeaderAttributeKey.OPERATION_TIMEOUT)));
      // handling msgSequenceNr
      SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(sessionId);
      msgSequenceNr.incrementAndGetMsgSequenceNr();
      // set up reply - SCMP Version
      SCMPMessage reply = new SCMPMessage(reqMessage.getSCMPVersion());
      reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
      reply.setServiceName(serviceName);
      reply.setSessionId(reqMessage.getSessionId());
      reply.setMessageType(this.getKey());
      response.setSCMP(reply);
    } finally {
View Full Code Here

    // inform callback with scMessages
    SCMessage scReply = srvService.getCallback().execute(scMessage,
        Integer.parseInt(reqMessage.getHeader(SCMPHeaderAttributeKey.OPERATION_TIMEOUT)));

    // handling msgSequenceNr
    SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(reqMessage
        .getSessionId());
    msgSequenceNr.incrementAndGetMsgSequenceNr();
    // set up reply - SCMP Version request
    SCMPMessage reply = new SCMPMessage(reqMessage.getSCMPVersion());
    reply.setServiceName(serviceName);
    reply.setSessionId(reqMessage.getSessionId());
    reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
    reply.setMessageType(this.getKey());
    if (scReply != null) {
      reply.setBody(scReply.getData());
      if (scReply.getCacheExpirationDateTime() != null) {
        reply.setHeader(SCMPHeaderAttributeKey.CACHE_EXPIRATION_DATETIME,
View Full Code Here

        reply.setHeaderFlag(SCMPHeaderAttributeKey.REJECT_SESSION);
      } else {
        // create session in SCMPSessionCompositeRegistry
        SrvCommandAdapter.sessionCompositeRegistry.addSession(sessionId);
        // handling msgSequenceNr
        SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(sessionId);
        reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
      }
      if (scReply.getSessionInfo() != null) {
        reply.setHeader(SCMPHeaderAttributeKey.SESSION_INFO, scReply.getSessionInfo());
      }
    }
View Full Code Here

        reply.setHeaderFlag(SCMPHeaderAttributeKey.REJECT_SESSION);
      } else {
        // create session in SCMPSessionCompositeRegistry
        SrvCommandAdapter.sessionCompositeRegistry.addSession(sessionId);
        // handling msgSequenceNr
        SCMPMessageSequenceNr msgSequenceNr = SrvCommandAdapter.sessionCompositeRegistry.getSCMPMsgSequenceNr(sessionId);
        reply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.getCurrentNr());
      }
      if (scReply.getSessionInfo() != null) {
        reply.setHeader(SCMPHeaderAttributeKey.SESSION_INFO, scReply.getSessionInfo());
      }
    }
View Full Code Here

    try {
      if (responseMessage.isLargeMessage()) {
        // response is large create a large response for reply
        SCMPCompositeSender largeResponse = new SCMPCompositeSender(responseMessage);
        SCMPMessage firstSCMP = largeResponse.getFirst();
        SCMPMessageSequenceNr messageSequenceNr = this.requester.getSCMPMsgSequenceNr();
        firstSCMP.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, messageSequenceNr.incrementAndGetMsgSequenceNr());
        int oti = requestMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
        // adding compositeReceiver to the composite registry
        SCBaseServlet.compositeRegistry.addSCMPLargeResponse(requestMessage.getSessionId(), largeResponse, oti);
        responseMessage = firstSCMP;
      }
View Full Code Here

TOP

Related Classes of org.serviceconnector.scmp.SCMPMessageSequenceNr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.