Example usage for javax.jms TextMessage getText

List of usage examples for javax.jms TextMessage getText

Introduction

In this page you can find the example usage for javax.jms TextMessage getText.

Prototype


String getText() throws JMSException;

Source Link

Document

Gets the string containing this message's data.

Usage

From source file:ConsumerTool.java

public void onMessage(Message message) {

    messagesReceived++;/*from   w  w  w.j a v  a2 s .  c  o  m*/

    try {

        if (message instanceof TextMessage) {
            TextMessage txtMsg = (TextMessage) message;
            if (verbose) {

                String msg = txtMsg.getText();
                int length = msg.length();
                if (length > 50) {
                    msg = msg.substring(0, 50) + "...";
                }
                System.out.println("[" + this.getName() + "] Received: '" + msg + "' (length " + length + ")");
            }
        } else {
            if (verbose) {
                System.out.println("[" + this.getName() + "] Received: '" + message + "'");
            }
        }

        if (message.getJMSReplyTo() != null) {
            replyProducer.send(message.getJMSReplyTo(),
                    session.createTextMessage("Reply: " + message.getJMSMessageID()));
        }

        if (transacted) {
            if ((messagesReceived % batch) == 0) {
                System.out.println("Commiting transaction for last " + batch + " messages; messages so far = "
                        + messagesReceived);
                session.commit();
            }
        } else if (ackMode == Session.CLIENT_ACKNOWLEDGE) {
            if ((messagesReceived % batch) == 0) {
                System.out.println(
                        "Acknowledging last " + batch + " messages; messages so far = " + messagesReceived);
                message.acknowledge();
            }
        }

    } catch (JMSException e) {
        System.out.println("[" + this.getName() + "] Caught: " + e);
        e.printStackTrace();
    } finally {
        if (sleepTime > 0) {
            try {
                Thread.sleep(sleepTime);
            } catch (InterruptedException e) {
            }
        }
    }
}

From source file:com.inkubator.hrm.service.impl.JadwalKerjaMassExceptionMessagesListener.java

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class)
public void onMessage(Message message) {
    try {//from   ww  w .j av a2  s.  c  o m
        TextMessage textMessage = (TextMessage) message;
        JSONObject jSONObject = new JSONObject(textMessage.getText());
        long workingGroupId = Long.parseLong(jSONObject.getString("groupWorkingId"));
        String listEmp = jSONObject.getString("listEmpId");
        Date createOn = new SimpleDateFormat("dd-MM-yyyy hh:mm").parse(jSONObject.getString("createDate"));
        String createBy = jSONObject.getString("createBy");
        String startDateString = jSONObject.getString("startDate");
        String endDateString = jSONObject.getString("endDate");
        Date startProposeDate = new SimpleDateFormat("dd-MM-yyyy hh:mm")
                .parse(jSONObject.getString("startDate"));
        Gson gson = new GsonBuilder().create();
        //            List<TempJadwalKaryawan> dataToDelete = new ArrayList<>();
        TypeToken<List<Long>> token = new TypeToken<List<Long>>() {
        };
        List<Long> dataEmpId = gson.fromJson(listEmp, token.getType());
        //Date now = new Date();
        WtGroupWorking groupWorking = wtGroupWorkingDao.getEntiyByPK(workingGroupId);
        Date startDate = groupWorking.getBeginTime();//tidak ditempatkan di dalam loop karena untuk groupworking yang sama
        Date endDate = groupWorking.getEndTime();

        int numberOfDay = DateTimeUtil.getTotalDayDifference(startDate, endDate);
        int totalDateDif = DateTimeUtil.getTotalDayDifference(startDate, startProposeDate) + 1;
        int num = numberOfDay + 1;
        int hasilBagi = (totalDateDif) / (num);

        Date tanggalAkhirJadwal = new SimpleDateFormat("dd-MM-yyyy hh:mm")
                .parse(jSONObject.getString("endDate"));
        //        String dayBegin = new SimpleDateFormat("EEEE").format(endDate);
        //        String dayNow = new SimpleDateFormat("EEEE").format(now);
        Date beginScheduleDate;
        if (new SimpleDateFormat("ddMMyyyy").format(tanggalAkhirJadwal)
                .equals(new SimpleDateFormat("ddMMyyyy").format(new Date()))) {
            beginScheduleDate = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num) - num,
                    CommonUtilConstant.DATE_FORMAT_DAY);
        } else {
            beginScheduleDate = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num),
                    CommonUtilConstant.DATE_FORMAT_DAY);
        }

        List<TempJadwalKaryawan> dataToSave = new ArrayList<>();
        TempJadwalKaryawan jadwalKaryawan;
        for (Long id : dataEmpId) {
            //                dataToDelete.addAll(tempJadwalKaryawanDao.getAllByEmpId(id)); for bussiner process Sake so must be close
            List<WtScheduleShift> dataScheduleShift = new ArrayList<>(groupWorking.getWtScheduleShifts());
            //                Collections.sort(dataScheduleShift, shortByDate1);

            int totaldayPropsot = DateTimeUtil.getTotalDayDifference(startProposeDate, tanggalAkhirJadwal);

            int loop = totaldayPropsot / dataScheduleShift.size();
            List<WtScheduleShift> sortedDataScheduleShift = Lambda.sort(dataScheduleShift,
                    Lambda.on(WtScheduleShift.class).getScheduleDate());
            int i = 0;
            //                for (int a = 0; a < loop; a++) {
            for (WtScheduleShift wtScheduleShift : sortedDataScheduleShift) {
                String onlyDate = new SimpleDateFormat("yyyy-MM-dd").format(
                        DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY));
                Date olnyDate = new SimpleDateFormat("yyyy-MM-dd").parse(onlyDate);

                jadwalKaryawan = tempJadwalKaryawanDao.getByEmpId(id, olnyDate);
                if (jadwalKaryawan != null) {
                    jadwalKaryawan.setUpdatedBy(createBy);
                    jadwalKaryawan.setUpdatedOn(new Date());
                    //                jadwalKaryawan = tempJadwalKaryawanDao.getByEmpId(empData.getId(), olnyDate);
                } else {
                    jadwalKaryawan = new TempJadwalKaryawan();
                    jadwalKaryawan.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12)));
                    jadwalKaryawan.setEmpData(empDataDao.getEntiyByPK(id));
                    jadwalKaryawan.setTanggalWaktuKerja(
                            DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY));
                    jadwalKaryawan.setCreatedBy(createBy);
                    jadwalKaryawan.setCreatedOn(createOn);

                }
                //                    TempJadwalKaryawan jadwalKaryawan = new TempJadwalKaryawan();
                //                    jadwalKaryawan.setEmpData(empDataDao.getEntiyByPK(id));
                //                    jadwalKaryawan.setTanggalWaktuKerja(DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY));
                //                    jadwalKaryawan.setWtWorkingHour(wtScheduleShift.getWtWorkingHour());
                WtHoliday holiday = wtHolidayDao.getWtHolidayByDate(jadwalKaryawan.getTanggalWaktuKerja());
                if (holiday != null && groupWorking.getTypeSequeace().equals(HRMConstant.NORMAL_SCHEDULE)) {
                    jadwalKaryawan.setWtWorkingHour(wtWorkingHourDao.getByCode("OFF"));
                } else {
                    jadwalKaryawan.setWtWorkingHour(wtScheduleShift.getWtWorkingHour());
                }
                //                    WtHoliday holiday = wtHolidayDao.getWtHolidayByDate(jadwalKaryawan.getTanggalWaktuKerja());
                //                    if (holiday != null || wtScheduleShift.getWtWorkingHour().getCode().equalsIgnoreCase("OFF")) {
                //                        jadwalKaryawan.setAttendanceStatus(attendanceStatusDao.getByCode("OFF"));
                //                    } else {
                //                        jadwalKaryawan.setAttendanceStatus(attendanceStatusDao.getByCode("HD1"));
                //                    }
                jadwalKaryawan.setIsCollectiveLeave(Boolean.FALSE);
                Date jadwal = jadwalKaryawan.getTanggalWaktuKerja();
                if (jadwal.equals(startProposeDate) || jadwal.equals(tanggalAkhirJadwal)) {
                    dataToSave.add(jadwalKaryawan);
                }
                if ((jadwal.after(startProposeDate) && jadwal.before(tanggalAkhirJadwal))) {
                    dataToSave.add(jadwalKaryawan);
                }
                i++;
            }
            //                }
        }
        //            tempJadwalKaryawanDao.deleteBacth(dataToDelete);
        tempJadwalKaryawanDao.saveBatch(dataToSave);

        //sending email process
        //            this.sendingEmailJadwalKaryawan(dataToSave, jSONObject.getString("locale"));
    } catch (Exception ex) {
        LOGGER.error("Error", ex);
    }
}

From source file:org.apache.activemq.usecases.DurableSubscriberWithNetworkDisconnectTest.java

public void testSendOnAReceiveOnBWithTransportDisconnect() throws Exception {
    bridgeBrokers(SPOKE, HUB);/*from w ww  .  j  av  a  2s .  c  om*/

    startAllBrokers();

    // Setup connection
    URI hubURI = brokers.get(HUB).broker.getVmConnectorURI();
    URI spokeURI = brokers.get(SPOKE).broker.getVmConnectorURI();
    ActiveMQConnectionFactory facHub = new ActiveMQConnectionFactory(hubURI);
    ActiveMQConnectionFactory facSpoke = new ActiveMQConnectionFactory(spokeURI);
    Connection conHub = facHub.createConnection();
    Connection conSpoke = facSpoke.createConnection();
    conHub.setClientID("clientHUB");
    conSpoke.setClientID("clientSPOKE");
    conHub.start();
    conSpoke.start();
    Session sesHub = conHub.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Session sesSpoke = conSpoke.createSession(false, Session.AUTO_ACKNOWLEDGE);

    ActiveMQTopic topic = new ActiveMQTopic("TEST.FOO");
    String consumerName = "consumerName";

    // Setup consumers
    MessageConsumer remoteConsumer = sesSpoke.createDurableSubscriber(topic, consumerName);
    remoteConsumer.setMessageListener(new MessageListener() {
        public void onMessage(Message msg) {
            try {
                TextMessage textMsg = (TextMessage) msg;
                receivedMsgs++;
                LOG.info("Received messages (" + receivedMsgs + "): " + textMsg.getText());
            } catch (JMSException e) {
                e.printStackTrace();
            }
        }
    });

    // allow subscription information to flow back to Spoke
    sleep(1000);

    // Setup producer
    MessageProducer localProducer = sesHub.createProducer(topic);
    localProducer.setDeliveryMode(DeliveryMode.PERSISTENT);

    // Send messages
    for (int i = 0; i < MESSAGE_COUNT; i++) {
        sleep(50);
        if (i == 50 || i == 150) {
            if (simulateStalledNetwork) {
                socketProxy.pause();
            } else {
                socketProxy.close();
            }
            networkDownTimeStart = System.currentTimeMillis();
        } else if (networkDownTimeStart > 0) {
            // restart after NETWORK_DOWN_TIME seconds
            sleep(NETWORK_DOWN_TIME);
            networkDownTimeStart = 0;
            if (simulateStalledNetwork) {
                socketProxy.goOn();
            } else {
                socketProxy.reopen();
            }
        } else {
            // slow message production to allow bridge to recover and limit message duplication
            sleep(500);
        }
        Message test = sesHub.createTextMessage("test-" + i);
        localProducer.send(test);
    }

    LOG.info("waiting for messages to flow");
    Wait.waitFor(new Wait.Condition() {
        @Override
        public boolean isSatisified() throws Exception {
            return receivedMsgs >= MESSAGE_COUNT;
        }
    });

    assertTrue("At least message " + MESSAGE_COUNT + " must be received, count=" + receivedMsgs,
            MESSAGE_COUNT <= receivedMsgs);
    brokers.get(HUB).broker.deleteAllMessages();
    brokers.get(SPOKE).broker.deleteAllMessages();
    conHub.close();
    conSpoke.close();
}

From source file:org.codehaus.stomp.jms.StompSession.java

protected StompFrame convertMessage(Message message) throws JMSException, UnsupportedEncodingException {
    StompFrame command = new StompFrame();
    command.setAction(Stomp.Responses.MESSAGE);
    Map headers = new HashMap(25);
    command.setHeaders(headers);//from   ww w  .  j a  v a 2  s .  c om

    copyStandardHeadersFromMessageToFrame(message, command);

    if (message instanceof TextMessage) {
        TextMessage msg = (TextMessage) message;
        command.setContent(msg.getText().getBytes(StandardCharsets.UTF_8));
    } else if (message instanceof BytesMessage) {

        BytesMessage msg = (BytesMessage) message;
        byte[] data = new byte[(int) msg.getBodyLength()];
        msg.readBytes(data);

        headers.put(Stomp.Headers.CONTENT_LENGTH, "" + data.length);
        command.setContent(data);
    }
    return command;
}

From source file:org.ala.jms.service.JmsMessageListener.java

public Method getMethod(Message message) {
    try {/*from   w w  w. jav a2s .c  o  m*/
        logger.debug("Message type: " + message.getClass().getName() + ", TextMessage: "
                + (message instanceof TextMessage));
        if (message.getStringProperty(MESSAGE_METHOD) != null
                && !"".equals(message.getStringProperty(MESSAGE_METHOD))) {
            return Method.valueOf(message.getStringProperty(MESSAGE_METHOD));
        }
        if (message instanceof TextMessage) {
            //parse the message
            TextMessage tm = (TextMessage) message;
            String json = tm.getText();
            if (StringUtils.isNotEmpty(json)) {
                Map<String, Object> omap = mapper.readValue(json, new TypeReference<HashMap<String, Object>>() {
                });
                String messageMethod = (String) omap.get("messageMethod");
                if (StringUtils.isNotEmpty(messageMethod)) {
                    return Method.valueOf(messageMethod);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        logger.error(e.getMessage(), e);
    }
    return null;
}

From source file:org.fusesource.mq.itests.MQDistroTest.java

@Test
public void testWebConsoleAndClient() throws Exception {
    // send message via webconsole, consume from jms openwire
    HttpClient client = new HttpClient();

    // set credentials
    client.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
            new UsernamePasswordCredentials(USER_NAME_ND_PASSWORD, USER_NAME_ND_PASSWORD));

    // need to first get the secret
    GetMethod get = new GetMethod(WEB_CONSOLE_URL + "send.jsp");
    get.setDoAuthentication(true);/*from w w  w  .j av a2  s  . co  m*/

    // Give console some time to start
    for (int i = 0; i < 20; i++) {
        Thread.currentThread().sleep(1000);
        try {
            i = client.executeMethod(get);
        } catch (java.net.ConnectException ignored) {
        }
    }
    assertEquals("get succeeded on " + get, 200, get.getStatusCode());

    String response = get.getResponseBodyAsString();
    final String secretMarker = "<input type=\"hidden\" name=\"secret\" value=\"";
    String secret = response.substring(response.indexOf(secretMarker) + secretMarker.length());
    secret = secret.substring(0, secret.indexOf("\"/>"));

    final String destination = "validate.console.send";
    final String content = "Hi for the " + Math.random() + "' time";

    PostMethod post = new PostMethod(WEB_CONSOLE_URL + "sendMessage.action");
    post.setDoAuthentication(true);
    post.addParameter("secret", secret);

    post.addParameter("JMSText", content);
    post.addParameter("JMSDestination", destination);
    post.addParameter("JMSDestinationType", "queue");

    // execute the send
    assertEquals("post succeeded, " + post, 302, client.executeMethod(post));

    // consume what we sent
    ActiveMQConnection connection = (ActiveMQConnection) new ActiveMQConnectionFactory()
            .createConnection(USER_NAME_ND_PASSWORD, USER_NAME_ND_PASSWORD);
    connection.start();
    try {
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        TextMessage textMessage = (TextMessage) session.createConsumer(new ActiveMQQueue(destination))
                .receive(10 * 1000);
        assertNotNull("got a message", textMessage);
        assertEquals("it is ours", content, textMessage.getText());
    } finally {
        connection.close();
    }

    // verify osgi registration of cf
    ConnectionFactory connectionFactory = getOsgiService(ConnectionFactory.class);
    assertTrue(connectionFactory instanceof ActiveMQConnectionFactory);
    ActiveMQConnection connectionFromOsgiFactory = (ActiveMQConnection) connectionFactory
            .createConnection(USER_NAME_ND_PASSWORD, USER_NAME_ND_PASSWORD);
    connectionFromOsgiFactory.start();
    try {
        assertEquals("same broker", connection.getBrokerName(), connectionFromOsgiFactory.getBrokerName());
    } finally {
        connectionFromOsgiFactory.close();
    }

    // verify mq-client
    Process process = Runtime.getRuntime()
            .exec("java -jar extras" + File.separator + "mq-client.jar producer --count 1 --user "
                    + USER_NAME_ND_PASSWORD + " --password " + USER_NAME_ND_PASSWORD, null, // env
                    new File(System.getProperty("user.dir")));
    process.waitFor();
    assertEquals("producer worked, exit(0)?", 0, process.exitValue());

    process = Runtime.getRuntime()
            .exec("java -jar extras" + File.separator + "mq-client.jar consumer --count 1 --user "
                    + USER_NAME_ND_PASSWORD + " --password " + USER_NAME_ND_PASSWORD, null, // env
                    new File(System.getProperty("user.dir")));
    process.waitFor();
    assertEquals("consumer worked, exit(0)?", 0, process.exitValue());

    System.out.println(executeCommand("activemq:bstat"));
}

From source file:org.fatal1t.forexapp.spring.api.adapters.SyncListener.java

@JmsListener(destination = "forex.sync.listener.connector.request", containerFactory = "myJmsContainerFactory")
public void receiveMessage(TextMessage message) throws JMSException {
    log.info("Source Queue: " + message.getJMSDestination().toString());
    log.info("Target Queue: " + message.getJMSReplyTo().toString());
    log.info("Received:" + message.getJMSCorrelationID() + " " + message.getJMSType() + " <"
            + message.getText().substring(0, 50) + ">");
    initiateAdapter();/*from   ww w  .j  a  va 2s .co  m*/
    if (!initiateAdapter()) {
        log.info("pruser s adapterem");
        sendMessage("Error in adapter setting, cant login", message.getJMSCorrelationID(),
                message.getJMSReplyTo());
    }
    XStream xs = new XStream();
    Object o = xs.fromXML(message.getText());
    System.out.println(message.getText());
    switch (message.getJMSType()) {
    case "GetUserData": {
        GetUserDataResp APIResponse = this.APIAdapter.GetUserData();
        sendMessage(xs.toXML(APIResponse), message.getJMSCorrelationID(), message.getJMSReplyTo());
        break;
    }
    case "GetAllSymbols": {
        GetAllSymbolsResp APIResp = this.APIAdapter.GetAllSymbols();
        sendMessage(xs.toXML(APIResp), message.getJMSCorrelationID(), message.getJMSReplyTo());
        break;
    }
    case "GetTradingHours": {
        GetTradingHoursResp APIResp = this.APIAdapter.GetTradingHours((GetTradingHoursReq) o);
        sendMessage(xs.toXML(APIResp), message.getJMSCorrelationID(), message.getJMSReplyTo());
        break;
    }
    case "GetCandlesHistory": {
        GetCandlesHistoryReq request = (GetCandlesHistoryReq) o;
        GetCandlesHistoryResp response = new GetCandlesHistoryResp();
        request.getRequestList().forEach((CandlesRange range) -> {
            GetCandlesRangeResp APIResp = this.APIAdapter.getCandlesRange(request.getSymbol(), range);
            response.getRecords().put(range.getId(), APIResp.getRecords());
        });
        sendMessage(xs.toXML(response), message.getJMSCorrelationID(), message.getJMSReplyTo());
        break;
    }
    }
}

From source file:com.linagora.obm.sync.TestQueueManager.java

@Test
public void testTwoConsumers() throws Exception {
    String testText = "test text";

    Connection connection = createManagedConnection();
    connection.start();//w  ww.j  av a 2 s  .  c  o  m
    Session consumerSession1 = createManagedSession(connection);
    MessageConsumer consumer1 = queueManager.createConsumerOnTopic(consumerSession1, TOPIC);

    Session consumerSession2 = createManagedSession(connection);
    MessageConsumer consumer2 = queueManager.createConsumerOnTopic(consumerSession2, TOPIC);

    writeMessageOnTopic(testText, TOPIC, queueManager);

    TextMessage messageReceived1 = (TextMessage) consumer1.receive(TIMEOUT);
    TextMessage messageReceived2 = (TextMessage) consumer2.receive(TIMEOUT);
    Assert.assertEquals(testText, messageReceived1.getText());
    Assert.assertEquals(testText, messageReceived2.getText());
}

From source file:drepcap.frontend.jms.JmsAdapter.java

/**
 * /*from   ww  w . j av a  2s  .  c  o  m*/
 * Components are typically pcap-sensors or packet-mergers. The component
 * name is the name without any additional suffix, e.g.,
 * "pcap.single.raw.2".
 * 
 * @param connection
 * @param componentName
 * @throws JMSException
 */
public JmsAdapter(Connection connection, String componentName) throws JMSException {
    this.componentName = componentName;
    this.connection = connection;
    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

    commandTopic = session.createTopic(componentName + ".command");
    commandConsumer = session.createConsumer(commandTopic);
    commandConsumer.setMessageListener(new MessageListener() {
        @Override
        public void onMessage(Message msg) {
            if (msg instanceof TextMessage) {
                TextMessage textMsg = (TextMessage) msg;
                try {
                    final String txt = textMsg.getText();

                    for (StringReceiver cmdReplyReceiver : commandReplyReceivers) {
                        if (cmdReplyReceiver != null && txt.startsWith("reply")) {
                            cmdReplyReceiver.process(txt.replaceFirst("reply ", ""));
                        }
                    }
                } catch (JMSException e) {
                    e.printStackTrace();
                }
            }
        }
    });
    commandProducer = session.createProducer(commandTopic);

    monitorTopic = session.createTopic(componentName + ".monitor");
    monitorConsumer = session.createConsumer(monitorTopic);
    monitorConsumer.setMessageListener(new MessageListener() {
        @Override
        public void onMessage(Message msg) {
            if (msg instanceof TextMessage) {
                TextMessage textMsg = (TextMessage) msg;
                try {
                    final String txt = textMsg.getText();

                    for (StringReceiver monReceiver : monitorReceivers) {
                        if (monReceiver != null) {
                            monReceiver.process(txt);
                        }
                    }

                    if (statsDataReceivers.size() > 0) {
                        processStatsFromString(txt);
                    }
                } catch (JMSException e) {
                    e.printStackTrace();
                }
            }
        }
    });
}

From source file:eu.planets_project.tb.impl.system.batch.listener.BatchExperimentListenerImpl.java

public void doOnMessage(Message m, long timeOutMillis, Thread thread) {
    log.debug("BatchExecutionListener: doOnMessage");
    //1.check if message got redelivered before doing any processing
    try {/*from w ww . j a va2  s. co m*/
        if (m.getJMSRedelivered()) {
            log.debug(
                    "BatchExperimentListener_shortTimeout: onMessage: re-receive message from the queue. Not processing it");
            return;
        }
    } catch (JMSException e) {
        log.debug(e);
        return;
    }

    //2. extract the message: it contains the ticket for identifying the job on the workflow system
    TextMessage msg = null;
    String ticket = "";
    String batchProcessorID = "";
    if (m instanceof TextMessage) {
        msg = (TextMessage) m;
        try {
            ticket = msg.getText();
            batchProcessorID = msg.getStringProperty(BatchProcessor.QUEUE_PROPERTY_NAME_FOR_SENDING);

            log.debug("BatchExperimentListener_shortTimeout: received message at timestamp: "
                    + msg.getJMSTimestamp() + " for ticket: " + ticket + "on batch processor: "
                    + batchProcessorID);
        } catch (JMSException e) {
            log.debug(e);
            return;
        }
    } else {
        return;
    }

    //3. get the BatchProcessing system that's notified
    TestbedBatchProcessorManager batchManager = TestbedBatchProcessorManager.getInstance();
    BatchProcessor bp = batchManager.getBatchProcessor(batchProcessorID);

    //check rollback and if batch processor has persistent jobs
    if ((bp.getJob(ticket) == null) || (bp.getJobStatus(ticket).equals(TestbedBatchJob.NO_SUCH_JOB))) {
        log.debug("EJBTransactionRollback - BatchProcessor no persistent job - dropp job: " + ticket);
        return;
    }

    //4. check for updates and store extracted information in experiment
    long t0 = System.currentTimeMillis();
    long t1 = System.currentTimeMillis();

    boolean bInfomredStarted = false;
    //do until we have reached our time-out time or completed
    while (t1 - t0 < timeOutMillis) {

        //a) check started
        //use batchProcessor specific implementation for checking on this.
        boolean bStarted = bp.isStarted(ticket);
        if (bStarted) {
            if (!bInfomredStarted) {
                //callback: inform once about started
                bp.notifyStart(ticket, bp.getJob(ticket));
                log.debug("BatchExecutionListener: notify STARTED for: " + ticket);
                bInfomredStarted = true;
            }

            if (bp.isRunning(ticket)) {
                TestbedBatchJob job = bp.getJob(ticket);
                job.setStatus(TestbedBatchJob.RUNNING);
                bp.notifyRunning(ticket, job);
                log.debug("BatchExecutionListener: notify RUNNING for: " + ticket);

            }

            if (bp.isUpdated(ticket)) {
                bp.notifyUpdate(ticket, bp.getJob(ticket));
                log.debug("BatchExecutionListener: notify UPDATE for: " + ticket);

            }

            if (bp.isFailed(ticket)) {
                TestbedBatchJob job = bp.getJob(ticket);
                job.setStatus(TestbedBatchJob.FAILED);
                bp.notifyFailed(ticket, job);
                log.debug("BatchExecutionListener: notify FAILED for: " + ticket);

            }

            //check if completed
            if (bp.isCompleted(ticket)) {
                TestbedBatchJob job = bp.getJob(ticket);
                job.setStatus(TestbedBatchJob.DONE);
                bp.notifyComplete(ticket, job);
                log.debug("BatchExecutionListener: notify COMPLETE for: " + ticket);

                return;
            }

        }

        //status is: still no completed - sleep and repoll
        try {
            Thread.sleep(sleep);
        } catch (InterruptedException e) {
            log.debug("Error while waiting for ticket: " + ticket, e);
            TestbedBatchJob job = bp.getJob(ticket);
            job.setStatus(TestbedBatchJob.FAILED);
            bp.notifyFailed(ticket, job);
            return;
        }
        t1 = System.currentTimeMillis();
    }

    //b) in this case a time-out occurred
    TestbedBatchJob job = bp.getJob(ticket);
    job.setStatus(TestbedBatchJob.FAILED);
    job.setWorkflowFailureReport(new String("BatchExperimentListener with timeout of " + timeOutMillis / 1000
            + " Sec. has timed-out. This normally indicates a failure within the remote workflow execution processor"));
    bp.notifyFailed(ticket, job);
    log.debug("BatchExecutionListener: notify FAILED due to time-out for: " + ticket);
}