Example usage for javax.jms JMSException printStackTrace

List of usage examples for javax.jms JMSException printStackTrace

Introduction

In this page you can find the example usage for javax.jms JMSException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.sakaiproject.kernel.messaging.activemq.ActiveMQEmailDeliveryT.java

public void testCommonsEmailOneWaySeparateSessions() {

    Queue emailQueue = null;//  ww w  . ja  v a  2s  .com
    MessageConsumer consumer = null;
    MessageProducer producer = null;
    Session clientSession = null;
    Session listenerSession = null;
    // it is not necessary to use the Email interface here
    // Email is used here just to allow for multiple types of emails to
    // occupy
    // the same varaible. SimpleEmail etc can each be used directly.
    List<Email> emails = new ArrayList<Email>();
    EmailMessagingService messagingService = new EmailMessagingService(vmURL, emailQueueName, emailType, null,
            null, null, null);
    emails.add(new SimpleEmail(messagingService));
    emails.add(new MultiPartEmail(messagingService));
    emails.add(new HtmlEmail(messagingService));
    try {

        listenerSession = listenerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        emailQueue = listenerSession.createQueue(emailQueueName);

        consumer = listenerSession.createConsumer(emailQueue);

        consumer.setMessageListener(new EmailListener());

        listenerConn.start();

        listenerSession.run();

    } catch (JMSException e2) {
        e2.printStackTrace();
        Assert.assertTrue(false);
    }

    Wiser smtpServer = new Wiser();
    smtpServer.setPort(smtpTestPort);
    smtpServer.start();

    try {
        clientSession = clientConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        emailQueue = clientSession.createQueue(emailQueueName);
        producer = clientSession.createProducer(emailQueue);

        clientConn.start();
        clientSession.run();

    } catch (JMSException e) {
        e.printStackTrace();
        Assert.assertTrue(false);
    }

    for (Email em : emails) {

        try {
            em.addTo(TEST_EMAIL_TO);
            em.setFrom(TEST_EMAIL_FROM_ADDRESS, TEST_EMAIL_FROM_LABEL);
            // host and port will be ignored since the email session is
            // established
            // by
            // the listener
            em.setHostName("localhost");
            em.setSmtpPort(smtpTestPort);
            em.setSubject(TEST_EMAIL_SUBJECT);
            if (em instanceof HtmlEmail) {
                em.setMsg(TEST_EMAIL_BODY_HTMLEMAIL);
            } else if (em instanceof MultiPartEmail) {
                em.setMsg(TEST_EMAIL_BODY_MULTIPARTEMAIL);
            } else if (em instanceof SimpleEmail) {
                em.setMsg(TEST_EMAIL_BODY_SIMPLEEMAIL);
            }

        } catch (EmailException e1) {
            Assert.assertTrue(false);
            e1.printStackTrace();
        }

        try {
            em.buildMimeMessage();
        } catch (EmailException e1) {
            e1.printStackTrace();
            Assert.assertTrue(false);
        }

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        try {

            em.getMimeMessage().writeTo(os);
        } catch (javax.mail.MessagingException e) {
            e.printStackTrace();
            Assert.assertTrue(false);
        } catch (IOException e) {
            e.printStackTrace();
            Assert.assertTrue(false);
        }

        String content = os.toString();

        ObjectMessage om;
        try {
            om = clientSession.createObjectMessage(content);

            om.setJMSType(emailType);

            LOG.info("Client: Sending test message....");
            producer.send(om);
        } catch (JMSException e) {
            e.printStackTrace();
            Assert.assertTrue(false);
        }

    }

    long start = System.currentTimeMillis();
    while (listenerMessagesProcessed < 3 && System.currentTimeMillis() - start < 10000L) {
        // wait for transport
    }
    Assert.assertTrue(listenerMessagesProcessed == 3);

    List<WiserMessage> messages = smtpServer.getMessages();
    Assert.assertTrue(messages.size() + " != expected value of 3", messages.size() == 3);

    for (WiserMessage wisermsg : messages) {
        String body = null;
        String subject = null;
        MimeMessage testmail = null;

        try {
            testmail = wisermsg.getMimeMessage();
        } catch (MessagingException e) {
            Assert.assertTrue(false);
            e.printStackTrace();
        }

        if (testmail != null) {
            LOG.info("SMTP server: test email received: ");
            try {
                LOG.info("To: " + testmail.getHeader("To", ","));

                LOG.info("Subject: " + testmail.getHeader("Subject", ","));
                body = getBodyAsString(testmail.getContent());
                subject = testmail.getHeader("Subject", ",");
            } catch (MessagingException e) {
                Assert.assertTrue(false);
                e.printStackTrace();
            } catch (IOException e) {
                Assert.assertTrue(false);
                e.printStackTrace();
            }
            LOG.info("Body: " + body);
            Assert.assertTrue(subject.contains(TEST_EMAIL_SUBJECT));
            Assert.assertTrue(body.contains("This is a Commons"));
        } else {
            Assert.assertTrue(false);
        }
    }

    if (clientSession != null) {
        try {
            clientSession.close();
        } catch (JMSException e) {
            e.printStackTrace();
            Assert.assertTrue(false);
        }
        clientSession = null;
    }

    if (listenerSession != null) {
        try {
            listenerSession.close();
        } catch (JMSException e) {
            e.printStackTrace();
            Assert.assertTrue(false);
        }
        listenerSession = null;
    }

    smtpServer.stop();

}

From source file:com.alliander.osgp.acceptancetests.adhocmanagement.SetRebootSteps.java

@DomainStep("a set reboot response message with correlationId (.*), deviceId (.*), qresult (.*) and qdescription (.*) is found in the queue (.*)")
public void givenASetRebootResponseMessageIsFoundInTheQueue(final String correlationId, final String deviceId,
        final String qresult, final String qdescription, final Boolean isFound) {
    LOGGER.info(/*  ww w .j  a v a2  s .  c o m*/
            "GIVEN: \"a set reboot response message with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".",
            correlationId, deviceId, qresult, qdescription, isFound);

    if (isFound) {
        final ObjectMessage messageMock = mock(ObjectMessage.class);

        try {
            when(messageMock.getJMSCorrelationID()).thenReturn(correlationId);
            when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID);
            when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId);
            final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult);
            Serializable dataObject = null;
            OsgpException exception = null;
            if (result.equals(ResponseMessageResultType.NOT_OK)) {
                dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR,
                        ComponentType.UNKNOWN, new ValidationException());
                exception = (OsgpException) dataObject;
            }
            final ResponseMessage message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId,
                    result, exception, dataObject);
            when(messageMock.getObject()).thenReturn(message);
        } catch (final JMSException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        when(this.commonResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(messageMock);
    } else {
        when(this.commonResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(null);
    }
}

From source file:com.alliander.osgp.acceptancetests.schedulemanagement.SetScheduleSteps.java

@DomainStep("a set schedule response message with correlationId (.*), deviceId (.*), qresult (.*) and qdescription (.*) is found in the queue (.*)")
public void givenAScheduleLightResponseMessageIsFoundInTheQueue(final String correlationId,
        final String deviceId, final String qresult, final String qdescription, final Boolean isFound) {
    LOGGER.info(//from w  w w.j a v a2  s  . c  om
            "GIVEN: \"a set schedule response message with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".",
            correlationId, deviceId, qresult, qdescription, isFound);

    if (isFound) {
        final ObjectMessage messageMock = mock(ObjectMessage.class);

        try {
            when(messageMock.getJMSCorrelationID()).thenReturn(correlationId);
            when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID);
            when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId);

            final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult);
            Serializable dataObject = null;
            OsgpException exception = null;
            if (result.equals(ResponseMessageResultType.NOT_OK)) {
                dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, null,
                        new ValidationException());
                exception = (OsgpException) dataObject;
            }
            final ResponseMessage message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId,
                    ResponseMessageResultType.valueOf(qresult), exception, dataObject);
            when(messageMock.getObject()).thenReturn(message);
        } catch (final JMSException e) {
            e.printStackTrace();
        }

        when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class)))
                .thenReturn(messageMock);
    } else {
        when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(null);
    }
}

From source file:com.alliander.osgp.acceptancetests.adhocmanagement.GetStatusSteps.java

@DomainStep("a get status response message for domainType (.*) with correlationId (.*), deviceId (.*), qresult (.*), qdescription (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*) is found in the queue (.*)")
public void givenAGetStatusResponseMessageIsFoundInQueue(final String domainType, final String correlationId,
        final String deviceId, final String qresult, final String qdescription, final String preferredLinkType,
        final String actualLinkType, final String lightType, final String eventNotifications,
        final String index, final String on, final String dimValue, final Boolean isFound) {
    LOGGER.info(// w w w . j  a  v  a 2  s .c  o m
            "GIVEN: \"a get status response message for domainType {} with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".",
            domainType, correlationId, deviceId, qresult, qdescription, isFound);

    if (isFound) {
        final ObjectMessage messageMock = mock(ObjectMessage.class);

        try {
            when(messageMock.getJMSCorrelationID()).thenReturn(correlationId);
            when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID);
            when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId);

            final LinkType prefLinkType = StringUtils.isBlank(preferredLinkType) ? null
                    : Enum.valueOf(LinkType.class, preferredLinkType);
            final LinkType actLinkType = StringUtils.isBlank(actualLinkType) ? null
                    : Enum.valueOf(LinkType.class, actualLinkType);
            final LightType lt = StringUtils.isBlank(lightType) ? null
                    : Enum.valueOf(LightType.class, lightType);

            // EventNotificationTypes
            int mask = 0;
            if (StringUtils.isNotBlank(eventNotifications)) {
                for (final String event : eventNotifications.split(",")) {
                    mask += (Enum.valueOf(EventNotificationType.class, event)).getValue();
                }
            }

            final ResponseMessage message;

            final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult);
            Serializable dataObject = null;

            if (result.equals(ResponseMessageResultType.NOT_OK)) {
                dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR,
                        ComponentType.UNKNOWN, new ValidationException());
                message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId, result,
                        (OsgpException) dataObject, dataObject);
            } else {
                if (domainType.equals(DomainType.PUBLIC_LIGHTING.name())) {
                    // DomainType.PUBLIC_LIGHTING
                    dataObject = new DeviceStatus(null, prefLinkType, actLinkType, lt, mask);
                } else {
                    // DomainType.TARIFF_SWITCHING
                    dataObject = new DeviceStatusMapped(null, null, prefLinkType, actLinkType, lt, mask);
                }
                message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId, result, null,
                        dataObject);
            }

            when(messageMock.getObject()).thenReturn(message);
        } catch (final JMSException e) {
            e.printStackTrace();
        }

        when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class)))
                .thenReturn(messageMock);
    } else {
        when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(null);
    }
}

From source file:com.alliander.osgp.acceptancetests.configurationmanagement.GetConfigurationDataSteps.java

@DomainStep("a get configuration response message with correlationId (.*), deviceId (.*), qresult (.*), qdescription (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*) is found in the queue (.*)")
public void givenAGetConfigurationResponseMessageIsFoundInQueue(final String correlationId,
        final String deviceId, final String qresult, final String qdescription, final String lightType,
        final String dcLights, final String dcMap, final String rcType, final String rcMap,
        final String shortInterval, final String preferredLinkType, final String meterType,
        final String longInterval, final String longIntervalType, final Boolean isFound) {
    LOGGER.info(/*from  ww w . ja  va  2 s .c o  m*/
            "GIVEN: \"a get configuration response message with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".",
            correlationId, deviceId, qresult, qdescription, isFound);

    if (isFound) {
        final ObjectMessage messageMock = mock(ObjectMessage.class);

        try {
            when(messageMock.getJMSCorrelationID()).thenReturn(correlationId);
            when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID);
            when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId);

            final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult);
            Serializable dataObject = null;
            OsgpException exception = null;

            if (result.equals(ResponseMessageResultType.NOT_OK)) {
                dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR,
                        ComponentType.UNKNOWN, new ValidationException());
                exception = (OsgpException) dataObject;
            } else {

                final com.alliander.osgp.domain.core.valueobjects.LightType lighttype = StringUtils
                        .isBlank(lightType) ? null
                                : Enum.valueOf(com.alliander.osgp.domain.core.valueobjects.LightType.class,
                                        lightType);
                final Map<Integer, Integer> indexAddressMap = new HashMap<Integer, Integer>();

                final com.alliander.osgp.domain.core.valueobjects.DaliConfiguration daliconfiguration = new com.alliander.osgp.domain.core.valueobjects.DaliConfiguration(
                        22, indexAddressMap);

                final List<com.alliander.osgp.domain.core.valueobjects.RelayMap> relayMap = new ArrayList<>();
                final com.alliander.osgp.domain.core.valueobjects.RelayConfiguration relayConf = new com.alliander.osgp.domain.core.valueobjects.RelayConfiguration(
                        relayMap);

                final MeterType metertype = StringUtils.isBlank(meterType) ? null
                        : Enum.valueOf(MeterType.class, meterType);
                final LongTermIntervalType longtermintervalType = StringUtils.isBlank(longIntervalType) ? null
                        : Enum.valueOf(LongTermIntervalType.class, longIntervalType);

                final Integer shortinterval = StringUtils.isBlank(shortInterval) ? 0
                        : Integer.valueOf(shortInterval);
                final Integer longinterval = StringUtils.isBlank(longInterval) ? 0
                        : Integer.valueOf(longInterval);

                // construct new Configuration
                dataObject = new com.alliander.osgp.domain.core.valueobjects.Configuration(lighttype,
                        daliconfiguration, relayConf, shortinterval, LinkType.ETHERNET, metertype, longinterval,
                        longtermintervalType);
            }

            final ResponseMessage message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId,
                    result, exception, dataObject);

            when(messageMock.getObject()).thenReturn(message);

        } catch (final JMSException e) {
            e.printStackTrace();
        }

        when(this.commonResponsesJmsTemplateMock.receiveSelected(any(String.class))).thenReturn(messageMock);
    } else {
        when(this.commonResponsesJmsTemplateMock.receiveSelected(any(String.class))).thenReturn(null);
    }
}

From source file:edu.harvard.iq.dvn.core.index.IndexServiceBean.java

private void sendMessage(final IndexEdit op) {
    QueueConnection conn = null;/*w w  w.  ja v a2s .c  o  m*/
    QueueSession session = null;
    QueueSender sender = null;
    try {
        conn = factory.createQueueConnection();
        session = conn.createQueueSession(false, 0);
        sender = session.createSender(queue);

        Message message = session.createObjectMessage(op);
        sender.send(message);

    } catch (JMSException ex) {
        ex.printStackTrace();
    } finally {
        try {
            if (sender != null) {
                sender.close();
            }
            if (session != null) {
                session.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (JMSException ex) {
            ex.printStackTrace();
        }
    }
}

From source file:org.wso2.carbon.sample.consumer.JMSQueueMessageConsumer.java

public void run() {
    // create queue connection
    QueueConnection queueConnection = null;
    try {/*from  w  w  w.j  av  a  2  s .c  o  m*/
        queueConnection = queueConnectionFactory.createQueueConnection();

        queueConnection.start();
    } catch (JMSException e) {
        log.info("Can not create queue connection." + e);
        return;
    }
    Session session = null;
    try {

        session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createQueue(queueName);
        MessageConsumer consumer = session.createConsumer(destination);

        int count = 0;
        long totalLatency = 0;
        long lastTimestamp = System.currentTimeMillis();

        while (active) {
            Message message = consumer.receive(1000);
            if (message != null) {
                //                    if (message instanceof MapMessage) {
                MapMessage mapMessage = (MapMessage) message;
                long currentTime = System.currentTimeMillis();
                long sentTimestamp = (Long) mapMessage.getObject("time");

                totalLatency = totalLatency + (currentTime - sentTimestamp);

                int logCount = 1000;

                if ((count % logCount == 0) && (count > warmUpCount)) {
                    double rate = (logCount * 1000.0d / (System.currentTimeMillis() - lastTimestamp));
                    log.info("Consumer: " + consumerId + " (" + logCount + " received) rate: " + rate
                            + " Latency:" + (totalLatency / (logCount * 1.0d)));
                    //                            log.info("total latency:" + totalLatency);
                    log.info("Total rate: " + (int) (consumers * rate));
                    totalLatency = 0;
                    lastTimestamp = System.currentTimeMillis();
                }
                count++;
            }
        }
        log.info("Finished listening for messages.");

    } catch (JMSException e) {
        log.info("Can not subscribe." + e);
    } finally {
        if (session != null) {
            try {
                session.close();
            } catch (JMSException e) {
                log.error(e);
            }
        }
        try {
            queueConnection.stop();
            queueConnection.close();
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}

From source file:edu.harvard.iq.dataverse.ingest.IngestServiceBean.java

public void startIngestJobs(Dataset dataset, AuthenticatedUser user) {
    int count = 0;
    List<DataFile> scheduledFiles = new ArrayList<>();

    IngestMessage ingestMessage = null;// w  ww . j av a2 s.  c o  m

    for (DataFile dataFile : dataset.getFiles()) {
        if (dataFile.isIngestScheduled()) {
            // todo: investigate why when calling save with the file object
            // gotten from the loop, the roles assignment added at create is removed
            // (switching to refinding via id resolves that)                
            dataFile = fileService.find(dataFile.getId());

            long ingestSizeLimit = -1;
            try {
                ingestSizeLimit = systemConfig.getTabularIngestSizeLimit(
                        getTabDataReaderByMimeType(dataFile.getContentType()).getFormatName());
            } catch (IOException ioex) {
                logger.warning(
                        "IO Exception trying to retrieve the ingestable format identifier from the plugin for type "
                                + dataFile.getContentType() + " (non-fatal);");
            }

            if (ingestSizeLimit == -1 || dataFile.getFilesize() < ingestSizeLimit) {
                dataFile.SetIngestInProgress();
                dataFile = fileService.save(dataFile);

                scheduledFiles.add(dataFile);

                logger.fine("Attempting to queue the file " + dataFile.getFileMetadata().getLabel()
                        + " for ingest, for dataset: " + dataset.getGlobalId());
                count++;
            } else {
                dataFile.setIngestDone();
                dataFile = fileService.save(dataFile);

                logger.info("Skipping tabular ingest of the file " + dataFile.getFileMetadata().getLabel()
                        + ", because of the size limit (set to " + ingestSizeLimit + " bytes).");
                // TODO: (urgent!)
                // send notification to the user!
            }
        }
    }

    if (count > 0) {
        String info = "Attempting to ingest " + count + " tabular data file(s).";
        logger.info(info);
        if (user != null) {
            datasetService.addDatasetLock(dataset.getId(), user.getId(), info);
        } else {
            datasetService.addDatasetLock(dataset.getId(), null, info);
        }

        DataFile[] scheduledFilesArray = (DataFile[]) scheduledFiles.toArray(new DataFile[count]);
        scheduledFiles = null;

        // Sort ingest jobs by file size: 
        Arrays.sort(scheduledFilesArray, new Comparator<DataFile>() {
            @Override
            public int compare(DataFile d1, DataFile d2) {
                long a = d1.getFilesize();
                long b = d2.getFilesize();
                return Long.valueOf(a).compareTo(b);
            }
        });

        ingestMessage = new IngestMessage(IngestMessage.INGEST_MESAGE_LEVEL_INFO);

        for (int i = 0; i < count; i++) {
            ingestMessage.addFileId(scheduledFilesArray[i].getId());
            logger.fine("Sorted order: " + i + " (size=" + scheduledFilesArray[i].getFilesize() + ")");
        }

        QueueConnection conn = null;
        QueueSession session = null;
        QueueSender sender = null;
        try {
            conn = factory.createQueueConnection();
            session = conn.createQueueSession(false, 0);
            sender = session.createSender(queue);

            //ingestMessage.addFile(new File(tempFileLocation));
            Message message = session.createObjectMessage(ingestMessage);

            //try {
            sender.send(message);
            //} catch (JMSException ex) {
            //    ex.printStackTrace();
            //}

        } catch (JMSException ex) {
            ex.printStackTrace();
            //throw new IOException(ex.getMessage());
        } finally {
            try {

                if (sender != null) {
                    sender.close();
                }
                if (session != null) {
                    session.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (JMSException ex) {
                ex.printStackTrace();
            }
        }
    }
}

From source file:it.isislab.dmason.util.SystemManagement.Master.thrower.DMasonMaster.java

private void getSteps() {
    connectionForSteps = new ConnectionNFieldsWithActiveMQAPI(new MyMessageListener() {
        long initial_time = -1;
        Long step;/*from   www  .j a  va  2 s  .  co m*/

        @Override
        public void onMessage(Message arg0) {
            Object o = null;
            try {
                o = parseMessage(arg0);
            } catch (JMSException e) {
                e.printStackTrace();
            }
            MyHashMap mh = (MyHashMap) o;
            if (mh.get("step") != null) {
                step = (Long) mh.get("step");

                if (step == 100) {
                    initial_time = System.currentTimeMillis();
                    logger.debug("Number regions:" + numRegions + " Number agents:" + numAgents + " Width:"
                            + WIDTH + " Height:" + HEIGHT);
                    logger.debug("Step :0 Time:" + initial_time);
                } else if (step == limitStep) {
                    long fifty_time = System.currentTimeMillis();
                    logger.debug("Step :" + limitStep + " Time: " + fifty_time);

                    long time = (fifty_time - initial_time);

                    logger.debug("Total Time : " + time);
                    notifyArea.append("Total Simulation Time : " + time + "ms for " + limitStep + " steps.");
                }
                writeStepLabel.setText("" + mh.get("step"));
            }
        }
    });
    try {
        connectionForSteps.setupConnection(address);
        connectionForSteps.createTopic("step", 1);
        connectionForSteps.subscribeToTopic("step");
        connectionForSteps.asynchronousReceive("step");
    } catch (Exception e) {
        e.printStackTrace();
    }
}