code: protected Message createMessageWithBinaryData(ConnectionContext context, BasicMessage basicMessage,
              InputStream inputStream, Map<String, String> headers) throws JMSException {
          if (context == null) {
              throw new IllegalArgumentException("The context is null");
          }
          if (basicMessage == null) {
              throw new IllegalArgumentException("The message is null");
          }
          if (inputStream == null) {
              throw new IllegalArgumentException("The binary data is null");
          }
  
          Session session = context.getSession();
          if (session == null) {
              throw new IllegalArgumentException("The context had a null session");
          }
  
          // we are going to use BinaryData which allows us to prefix the binary data with the JSON message
          BinaryData messagePlusBinaryData = new BinaryData(basicMessage.toJSON().getBytes(), inputStream);
  
          BytesMessage msg = session.createBytesMessage();
          msg.setObjectProperty("JMS_AMQ_InputStream", messagePlusBinaryData);
  
          setHeaders(basicMessage, headers, msg);
  
          log.infof("Created binary message [%s]", msg);
  
          return msg;
      }
docs: Creates a blob message that can be send via a producer that contains the given BasicMessage's JSON encoded data
  along with binary data.
  
  @param context the context whose session is used to create the message
  @param basicMessage contains the data that will be JSON-encoded and encapsulated in the created message, with
  optional headers included
  @param inputStream binary data that will be sent with the message
  @param headers headers for the Message that will override same-named headers in the basic message
  @return the message that can be produced
  @throws JMSException any error
  @throws NullPointerException if the context is null or the context's session is null