Package org.serviceconnector.call

Examples of org.serviceconnector.call.SCMPReceivePublicationCall


      return;
    }
    this.requester.getSCMPMsgSequenceNr().incrementAndGetMsgSequenceNr();
    // 2. initialize call & invoke
    SCPublishServiceCallback callback = new SCPublishServiceCallback(this, this.messageCallback);
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester, this.serviceName,
        this.sessionId);
    try {
      PerformanceLogger.begin(this.sessionId);
      receivePublicationCall.invoke(callback, Constants.SEC_TO_MILLISEC_FACTOR
          * (this.receivePublicationTimeoutSeconds + this.noDataIntervalSeconds));
    } catch (Exception e) {
      PerformanceLogger.end(this.sessionId);
      // inactivate the session
      this.sessionActive = false;
View Full Code Here


   *            the callback
   * @param timeoutMillis
   *            the timeout milliseconds
   */
  public void receivePublication(CascadedClient cascClient, ISCMPMessageCallback callback, int timeoutMillis) {
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
        cascClient.getServiceName(), cascClient.getSubscriptionId());
    long msgSeqNr = cascClient.getMsgSequenceNr().incrementAndGetMsgSequenceNr();
    receivePublicationCall.getRequest().setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSeqNr);
    try {
      receivePublicationCall.invoke(callback, timeoutMillis);
    } catch (Exception e) {
      // receive publication failed
      callback.receive(e);
      return;
    }
View Full Code Here

      return;
    }
    this.requester.getSCMPMsgSequenceNr().incrementAndGetMsgSequenceNr();
    // 2. initialize call & invoke
    SCGuardianCallback callback = new SCGuardianCallback(this, (SCGuardianMessageCallback) this.messageCallback);
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester, this.serviceName,
        this.sessionId);
    try {
      PerformanceLogger.begin(this.sessionId);
      receivePublicationCall.invoke(callback, Constants.SEC_TO_MILLISEC_FACTOR
          * (this.receivePublicationTimeoutSeconds + this.noDataIntervalSeconds));
    } catch (Exception e) {
      PerformanceLogger.end(this.sessionId);
      // inactivate the session
      this.sessionActive = false;
View Full Code Here

    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    Thread.sleep(55000);
    // receive publication - get message
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId);
    cbk = new TestCallback();
    receivePublicationCall.invoke(cbk, 20000);
    reply = cbk.getMessageSync(20000);
    TestUtil.checkReply(reply);
    Assert.assertFalse(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));
    Thread.sleep(55000);
    cbk = new TestCallback();
    receivePublicationCall.invoke(cbk, 20000);
    reply = cbk.getMessageSync(20000);
    TestUtil.checkReply(reply);
    Assert.assertFalse(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));
    Thread.sleep(55000);
    cbk = new TestCallback();
    receivePublicationCall.invoke(cbk, 20000);
    reply = cbk.getMessageSync(20000);
    TestUtil.checkReply(reply);
    Assert.assertFalse(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));
    Thread.sleep(55000);
    SCMPClnUnsubscribeCall unSubscribeCall = new SCMPClnUnsubscribeCall(this.requester, TestConstants.pubServerName1, sessionId);
View Full Code Here

    SCMPMessage reply = cbk.getMessageSync(2000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    // receive publication - no data
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId);
    receivePublicationCall.invoke(cbk, 30000);
    reply = cbk.getMessageSync(30000);
    Assert.assertTrue(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));

    SCMPClnChangeSubscriptionCall changeSubscriptionCall = new SCMPClnChangeSubscriptionCall(this.requester,
        TestConstants.pubServerName1, sessionId);
    // mask matches now
    changeSubscriptionCall.setMask(TestConstants.mask);
    changeSubscriptionCall.invoke(cbk, 3000);
    TestUtil.checkReply(cbk.getMessageSync(1000));

    // receive publication first message
    receivePublicationCall = new SCMPReceivePublicationCall(this.requester, TestConstants.pubServerName1, sessionId);
    receivePublicationCall.invoke(cbk, 10000);
    reply = cbk.getMessageSync(10000);
    Assert.assertFalse(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));

    SCMPClnUnsubscribeCall unSubscribeCall = new SCMPClnUnsubscribeCall(this.requester, TestConstants.pubServerName1, sessionId);
    unSubscribeCall.invoke(cbk, 3000);
View Full Code Here

    subscribeCall.invoke(cbk, 3000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();
    // receive publication - no data
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId);
    cbk = new TestCallback();
    receivePublicationCall.invoke(cbk, 30000);
    reply = cbk.getMessageSync(30000);
    TestUtil.checkReply(reply);
    Assert.assertTrue(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));

    SCMPClnUnsubscribeCall unSubscribeCall = new SCMPClnUnsubscribeCall(this.requester, TestConstants.pubServerName1, sessionId);
View Full Code Here

    SCMPMessage reply = cbk.getMessageSync(2000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    // receive publication - get message
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId);
    receivePublicationCall.invoke(cbk, 2000);
    reply = cbk.getMessageSync(20000);
    TestUtil.checkReply(reply);
    Assert.assertFalse(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));

    SCMPClnUnsubscribeCall unSubscribeCall = new SCMPClnUnsubscribeCall(this.requester, TestConstants.pubServerName1, sessionId);
View Full Code Here

    subscribeCall.invoke(cbk, 10000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId);
    cbk = new TestCallback();
    receivePublicationCall.invoke(cbk, 20000);
    reply = cbk.getMessageSync(20000);
    Assert.assertTrue(reply.isLargeMessage());
    Assert.assertEquals(TestUtil.getLargeString(), reply.getBody());

    SCMPClnUnsubscribeCall unSubscribeCall = new SCMPClnUnsubscribeCall(this.requester, TestConstants.pubServerName1, sessionId);
View Full Code Here

    SCMPMessage reply = cbk.getMessageSync(1000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    // receive publication - get message
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId);
    receivePublicationCall.invoke(cbk, 20000);
    reply = cbk.getMessageSync(15000);
    TestUtil.checkReply(reply);
    Assert.assertFalse(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));

    Thread.sleep(65000);
    receivePublicationCall = new SCMPReceivePublicationCall(this.requester, TestConstants.pubServerName1, sessionId);
    receivePublicationCall.invoke(cbk, 2000);
    reply = cbk.getMessageSync(1000);
    TestUtil.verifyError(reply, SCMPError.SUBSCRIPTION_NOT_FOUND, SCMPMsgType.RECEIVE_PUBLICATION);
  }
View Full Code Here

    String sessionId2 = reply2.getSessionId();

    // sleep 50 seconds - then send RCP for client1
    Thread.sleep(50000);
    // receive publication - get message
    SCMPReceivePublicationCall receivePublicationCall1 = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId1);
    cbk1 = new TestCallback();
    receivePublicationCall1.invoke(cbk1, 20000);
    reply1 = cbk1.getMessageSync(15000);
    TestUtil.checkReply(reply1);
    Assert.assertFalse(reply1.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));

    // sleep 15 seconds - client2 timed out
    Thread.sleep(15000);
    SCMPReceivePublicationCall receivePublicationCall2 = new SCMPReceivePublicationCall(this.requester,
        TestConstants.pubServerName1, sessionId2);
    cbk1 = new TestCallback();
    receivePublicationCall2.invoke(cbk1, 2000);
    reply1 = cbk1.getMessageSync(1000);
    TestUtil.verifyError(reply1, SCMPError.SUBSCRIPTION_NOT_FOUND, SCMPMsgType.RECEIVE_PUBLICATION);

    SCMPClnUnsubscribeCall unSubscribeCall = new SCMPClnUnsubscribeCall(this.requester, TestConstants.pubServerName1,
        sessionId1);
View Full Code Here

TOP

Related Classes of org.serviceconnector.call.SCMPReceivePublicationCall

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.