Java Code Examples for javax.jms.JMSException#toString()

The following examples show how to use javax.jms.JMSException#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsMessageConsumerImpl.java    From datacollector with Apache License 2.0 6 votes vote down vote up
@Override
public int take(BatchMaker batchMaker, Source.Context context, int batchSize, long messageIndex)
throws StageException {
  long start = System.currentTimeMillis();
  int numMessagesConsumed = 0;
  while (System.currentTimeMillis() - start < basicConfig.maxWaitTime && numMessagesConsumed < batchSize) {
    if (IS_TRACE_ENABLED) {
      LOG.trace("Attempting to take up to '{}' messages", (batchSize - numMessagesConsumed));
    }
    try {
      Message message = messageConsumer.receive(POLL_INTERVAL);
      if (message != null) {
        if (IS_TRACE_ENABLED) {
          LOG.trace("Got message: {}", message);
        }
        String messageId = jmsConfig.destinationName + "::" + messageIndex;
        int consumed = jmsMessageConverter.convert(batchMaker, context, messageId, message);
        messageIndex += consumed;
        numMessagesConsumed += consumed;
      }
    } catch (JMSException ex) {
      throw new StageException(JmsErrors.JMS_07, ex.toString(), ex);
    }
  }
  return numMessagesConsumed;
}
 
Example 2
Source File: MessageBodyToBytesConverter.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Override
public int read() throws IOException {
    try {
        return this.message.readByte();
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 3
Source File: MessageBodyToBytesConverter.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Override
public int read(byte[] buffer, int offset, int length) throws IOException {
    try {
        if (offset == 0)
            return this.message.readBytes(buffer, length);
        else
            return super.read(buffer, offset, length);
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 4
Source File: MessageBodyToBytesConverter.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Override
public int read(byte[] buffer) throws IOException {
    try {
        return this.message.readBytes(buffer);
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 5
Source File: MessageBodyToBytesConverter.java    From solace-integration-guides with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Override
public int read() throws IOException {
    try {
        return this.message.readByte();
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 6
Source File: MessageBodyToBytesConverter.java    From solace-integration-guides with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Override
public int read(byte[] buffer, int offset, int length) throws IOException {
    try {
        if (offset == 0)
            return this.message.readBytes(buffer, length);
        else
            return super.read(buffer, offset, length);
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 7
Source File: MessageBodyToBytesConverter.java    From solace-integration-guides with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Override
public int read(byte[] buffer) throws IOException {
    try {
        return this.message.readBytes(buffer);
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 8
Source File: JmsMessageConsumerImpl.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Override
public void commit() throws StageException {
  try {
    session.commit();
  } catch (JMSException ex) {
    throw new StageException(JmsErrors.JMS_08, ex.toString(), ex);
  }
}
 
Example 9
Source File: JmsMessageConsumerImpl.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Override
public void rollback() throws StageException {
  try {
    session.rollback();
  } catch (JMSException ex) {
    throw new StageException(JmsErrors.JMS_09, ex.toString(), ex);
  }
}
 
Example 10
Source File: JmsMessageProducerImpl.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Override
public void commit() throws StageException {
  try {
    session.commit();
  } catch (JMSException ex) {
    throw new StageException(JmsErrors.JMS_08, ex.toString(), ex);
  }
}
 
Example 11
Source File: JmsMessageProducerImpl.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Override
public void rollback() throws StageException {
  try {
    session.rollback();
  } catch (JMSException ex) {
    throw new StageException(JmsErrors.JMS_09, ex.toString(), ex);
  }
}
 
Example 12
Source File: MessageBodyToBytesConverter.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public int read() throws IOException {
    try {
        return this.message.readByte();
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 13
Source File: MessageBodyToBytesConverter.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public int read(byte[] buffer, int offset, int length) throws IOException {
    try {
        if (offset == 0) {
            return this.message.readBytes(buffer, length);
        } else {
            return super.read(buffer, offset, length);
        }
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 14
Source File: MessageBodyToBytesConverter.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public int read(byte[] buffer) throws IOException {
    try {
        return this.message.readBytes(buffer);
    } catch (JMSException e) {
        throw new IOException(e.toString());
    }
}
 
Example 15
Source File: TopicPublisher.java    From chipster with MIT License 5 votes vote down vote up
Object getReport(Message m) {
    try {
        return ((TextMessage)m).getText();
    } catch (JMSException e) {
        e.printStackTrace(System.out);
        return e.toString();
    }
}