Package org.jsmpp.session

Examples of org.jsmpp.session.MessageReceiverListener


            System.err.println("Failed connect and bind to host");
            e.printStackTrace();
        }
       
        // Set listener to receive deliver_sm
        session.setMessageReceiverListener(new MessageReceiverListener() {
            public void onAcceptDeliverSm(DeliverSm deliverSm)
                    throws ProcessRequestException {
                if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {
                    counter.incrementAndGet();
                    // delivery receipt
View Full Code Here


        // receive Message
        BasicConfigurator.configure();

        // Set listener to receive deliver_sm
        session.setMessageReceiverListener(new MessageReceiverListener() {

            public void onAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException {
                if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {
                    // delivery receipt
                    try {
View Full Code Here

                    closeSession(session);
                    reconnect(configuration.getInitialReconnectDelay());
                }
            }
        };
        this.messageReceiverListener = new MessageReceiverListener() {
            private final MessageIDGenerator messageIDGenerator = new RandomMessageIDGenerator();

            public void onAcceptAlertNotification(AlertNotification alertNotification) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Received an alertNotification " + alertNotification);
View Full Code Here

        super.doStart();

        session = createSMPPSession();
        session.setEnquireLinkTimer(this.configuration.getEnquireLinkTimer());
        session.setTransactionTimer(this.configuration.getTransactionTimer());
        session.setMessageReceiverListener(new MessageReceiverListener() {
            public void onAcceptAlertNotification(AlertNotification alertNotification) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Received an alertNotification " + alertNotification);
                }
View Full Code Here

        super.doStart();

        session = createSMPPSession();
        session.setEnquireLinkTimer(this.configuration.getEnquireLinkTimer());
        session.setTransactionTimer(this.configuration.getTransactionTimer());
        session.setMessageReceiverListener(new MessageReceiverListener() {
            public void onAcceptAlertNotification(AlertNotification alertNotification) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Received an alertNotification " + alertNotification);
                }
View Full Code Here

                    closeSession();
                    reconnect(configuration.getInitialReconnectDelay());
                }
            }
        };
        this.messageReceiverListener = new MessageReceiverListener() {
            private final MessageIDGenerator messageIDGenerator = new RandomMessageIDGenerator();

            public void onAcceptAlertNotification(AlertNotification alertNotification) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Received an alertNotification " + alertNotification);
View Full Code Here

    ExtendedSmppSession extendedSmppSession = smppSessionFactoryBean.getObject();
    Assert.assertTrue(extendedSmppSession instanceof ExtendedSmppSessionAdaptingDelegate);

    ExtendedSmppSessionAdaptingDelegate es = (ExtendedSmppSessionAdaptingDelegate) extendedSmppSession;
    Assert.assertNotNull("the factoried object should not be null", extendedSmppSession);
    es.addMessageReceiverListener(new MessageReceiverListener() {
      public void onAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException {
        logger.debug("in onAcceptDeliverSm");
      }

      public void onAcceptAlertNotification(AlertNotification alertNotification) {
        logger.debug("in onAcceptAlertNotification");
      }

      public DataSmResult onAcceptDataSm(DataSm dataSm, Session source) throws ProcessRequestException {
        logger.debug("in onAcceptDataSm");
        return null;
      }
    });
    Assert.assertEquals(extendedSmppSession.getClass(), ExtendedSmppSessionAdaptingDelegate.class);
    Assert.assertNotNull(es.getTargetClientSession());
    Assert.assertTrue(es.getTargetClientSession() != null);
    final SMPPSession s = es.getTargetClientSession();

    ReflectionUtils.doWithFields(ExtendedSmppSessionAdaptingDelegate.class, new ReflectionUtils.FieldCallback() {
      public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
        if (field.getName().equalsIgnoreCase("messageReceiverListener")) {
          field.setAccessible(true);
          MessageReceiverListener messageReceiverListener = (MessageReceiverListener) field.get(s);
          Assert.assertNotNull(messageReceiverListener);
          Assert.assertTrue(messageReceiverListener instanceof DelegatingMessageReceiverListener);
          final DelegatingMessageReceiverListener delegatingMessageReceiverListener = (DelegatingMessageReceiverListener) messageReceiverListener;
          ReflectionUtils.doWithFields(DelegatingMessageReceiverListener.class, new ReflectionUtils.FieldCallback() {
            public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
View Full Code Here

                    closeSession(session);
                    reconnect(configuration.getInitialReconnectDelay());
                }
            }
        };
        this.messageReceiverListener = new MessageReceiverListener() {
            private final MessageIDGenerator messageIDGenerator = new RandomMessageIDGenerator();

            public void onAcceptAlertNotification(AlertNotification alertNotification) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Received an alertNotification " + alertNotification);
View Full Code Here

TOP

Related Classes of org.jsmpp.session.MessageReceiverListener

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.