java.lang.Object
no.mnemonic.messaging.requestsink.jms.util.JMSUtils

public class JMSUtils extends Object
Package-local utilities, only to be used within this package
  • Field Details

    • DEFAULT_SEGMENT_WINDOW_SIZE

      public static final int DEFAULT_SEGMENT_WINDOW_SIZE
      See Also:
  • Method Details

    • createTextMessage

      public static javax.jms.TextMessage createTextMessage(javax.jms.Session session, String str, ProtocolVersion protocolVersion) throws javax.jms.JMSException
      Creates a JMS object from a string serializable object
      Parameters:
      str - string to create message from
      Returns:
      a JMS message created from given object
      Throws:
      javax.jms.JMSException
    • createByteMessage

      public static javax.jms.BytesMessage createByteMessage(javax.jms.Session session, byte[] data, ProtocolVersion protocolVersion, String serializerKey) throws javax.jms.JMSException
      Creates a JMS object from a serializable object. This kind of message is NOT compatible with a V13 JMS consumer class
      Parameters:
      data - data to create message from
      Returns:
      a JMS message created from given object
      Throws:
      javax.jms.JMSException
    • reassembleFragments

      public static byte[] reassembleFragments(Collection<MessageFragment> fragments, int expectedFragments, String md5Checksum) throws IOException, javax.jms.JMSException, ReassemblyMissingFragmentException
      Throws:
      IOException
      javax.jms.JMSException
      ReassemblyMissingFragmentException
    • fragment

      public static void fragment(InputStream messageData, int fragmentSize, FragmentConsumer consumer) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • isCompatible

      public static boolean isCompatible(javax.jms.Message message) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • getProtocolVersion

      public static ProtocolVersion getProtocolVersion(javax.jms.Message message) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • getSegmentWindowSize

      public static int getSegmentWindowSize(javax.jms.Message message) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • removeMessageListenerAndClose

      public static void removeMessageListenerAndClose(javax.jms.MessageConsumer consumer)
    • deleteTemporaryQueue

      public static void deleteTemporaryQueue(javax.jms.TemporaryQueue queue)
    • determineSerializer

      public static MessageSerializer determineSerializer(javax.jms.Message msg, MessageSerializer legacySerializer, Map<String,MessageSerializer> serializers) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • extractMessageBytes

      public static byte[] extractMessageBytes(javax.jms.Message msg) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • hex

      public static String hex(byte[] data)
    • md5

      public static String md5(byte[] data)
    • md5

      public static MessageDigest md5()
    • arraySubSeq

      public static byte[] arraySubSeq(byte[] a, int off, int len)
    • assertNotNull

      public static <T> T assertNotNull(T obj, String msg)
    • splitArray

      public static List<byte[]> splitArray(byte[] bytes, int maxlen)
      Parameters:
      bytes - bytes to splitArray
      Returns:
      list of byte arrays, each at most maxlen bytes, or null if bytes are null.