Package org.apache.qpid.proton.amqp.messaging

Examples of org.apache.qpid.proton.amqp.messaging.Section


      }
   }

   private static int getMessageType(Message protonMessage)
   {
      Section section = protonMessage.getBody();
      if (section instanceof AmqpValue)
      {
         AmqpValue amqpValue = (AmqpValue) section;
         Object value = amqpValue.getValue();
         if (value instanceof String)
View Full Code Here


         populateApplicationProperties(protonMessage.getApplicationProperties(), properties);
         populateProperties(protonMessage.getProperties(), properties, message);
         populateFooterProperties(protonMessage.getFooter(), properties);
         message.setTimestamp(System.currentTimeMillis());

         Section section = protonMessage.getBody();
         if (section instanceof AmqpValue)
         {
            AmqpValue amqpValue = (AmqpValue) section;
            Object value = amqpValue.getValue();
            if (value instanceof String)
View Full Code Here

         Header header = populateHeader(message, deliveryCount);
         DeliveryAnnotations deliveryAnnotations = populateDeliveryAnnotations(message);
         MessageAnnotations messageAnnotations = populateMessageAnnotations(message);
         Properties props = populateProperties(message);
         ApplicationProperties applicationProperties = populateApplicationProperties(message);
         Section section = populateBody(message);
         Footer footer = populateFooter(message);
         Set<SimpleString> propertyNames = message.getPropertyNames();
         for (SimpleString propertyName : propertyNames)
         {
            TypedProperties typedProperties = message.getTypedProperties();
View Full Code Here

      }
   }

   private static int getMessageType(Message protonMessage)
   {
      Section section = protonMessage.getBody();
      if (section instanceof AmqpValue)
      {
         AmqpValue amqpValue = (AmqpValue) section;
         Object value = amqpValue.getValue();
         if (value instanceof String)
View Full Code Here

         populateApplicationProperties(protonMessage.getApplicationProperties(), properties);
         populateProperties(protonMessage.getProperties(), properties, message);
         populateFooterProperties(protonMessage.getFooter(), properties);
         message.setTimestamp(System.currentTimeMillis());

         Section section = protonMessage.getBody();
         if (section instanceof AmqpValue)
         {
            AmqpValue amqpValue = (AmqpValue) section;
            Object value = amqpValue.getValue();
            if (value instanceof String)
View Full Code Here

         Header header = populateHeader(message, deliveryCount);
         DeliveryAnnotations deliveryAnnotations = populateDeliveryAnnotations(message);
         MessageAnnotations messageAnnotations = populateMessageAnnotations(message);
         Properties props = populateProperties(message);
         ApplicationProperties applicationProperties = populateApplicationProperties(message);
         Section section = populateBody(message);
         Footer footer = populateFooter(message);
         Set<SimpleString> propertyNames = message.getPropertyNames();
         for (SimpleString propertyName : propertyNames)
         {
            TypedProperties typedProperties = message.getTypedProperties();
View Full Code Here

        SWIGTYPE_p_pn_data_t body = Proton.pn_message_body(_impl);
        JNIData data = new JNIData(body);
        data.rewind();

        org.apache.qpid.proton.codec.Data.DataType dataType = data.next();
        Section section;
        if(dataType == null)
        {
            section = null;
        }
        else
View Full Code Here

        Header header = new Header();
        Properties props=new Properties();
        HashMap daMap = null;
        HashMap maMap = null;
        HashMap apMap = null;
        Section body=null;
        HashMap footerMap = null;
        if( msg instanceof BytesMessage ) {
            BytesMessage m = (BytesMessage)msg;
            byte data[] = new byte[(int) m.getBodyLength()];
            m.readBytes(data);
View Full Code Here

    @Override
    public Message transform(EncodedMessage amqpMessage) throws Exception {
        org.apache.qpid.proton.message.Message amqp = amqpMessage.decode();

        Message rc;
        final Section body = amqp.getBody();
        if( body == null ) {
            rc = vendor.createMessage();
        } else if( body instanceof Data ) {
            Binary d = ((Data) body).getValue();
            BytesMessage m = vendor.createBytesMessage();
            m.writeBytes(d.getArray(), d.getArrayOffset(), d.getLength());
            rc = m;
        } else if (body instanceof AmqpSequence ) {
            AmqpSequence sequence = (AmqpSequence) body;
            StreamMessage m = vendor.createStreamMessage();
            for( Object item : sequence.getValue()) {
                m.writeObject(item);
            }
            rc = m;
        } else if (body instanceof AmqpValue) {
            Object value = ((AmqpValue) body).getValue();
            if( value == null ) {
                rc = vendor.createObjectMessage();
            } if( value instanceof String ) {
                TextMessage m = vendor.createTextMessage();
                m.setText((String) value);
                rc = m;
            } else if( value instanceof Binary ) {
                Binary d = (Binary) value;
                BytesMessage m = vendor.createBytesMessage();
                m.writeBytes(d.getArray(), d.getArrayOffset(), d.getLength());
                rc = m;
            } else if( value instanceof List) {
                StreamMessage m = vendor.createStreamMessage();
                for( Object item : (List) value) {
                    m.writeObject(item);
                }
                rc = m;
            } else if( value instanceof Map) {
                MapMessage m = vendor.createMapMessage();
                final Set<Map.Entry<String, Object>> set = ((Map) value).entrySet();
                for (Map.Entry<String, Object> entry : set) {
                    m.setObject(entry.getKey(), entry.getValue());
                }
                rc = m;
            } else {
                ObjectMessage m = vendor.createObjectMessage();
                m.setObject((Serializable) value);
                rc = m;
            }
        } else {
            throw new RuntimeException("Unexpected body type: "+body.getClass());
        }
        rc.setJMSDeliveryMode(defaultDeliveryMode);
        rc.setJMSPriority(defaultPriority);
        rc.setJMSExpiration(defaultTtl);
View Full Code Here


        LOGGER.fine(bold("======== About to create a message and send it to the server"));

        _client.message = _messageFactory.createMessage();
        Section messageBody = new AmqpValue("Hello");
        _client.message.setBody(messageBody);
        _client.messageData = new byte[BUFFER_SIZE];
        int lengthOfEncodedMessage = _client.message.encode(_client.messageData, 0, BUFFER_SIZE);
        _testLoggingHelper.prettyPrint(TestLoggingHelper.MESSAGE_PREFIX, Arrays.copyOf(_client.messageData, lengthOfEncodedMessage));
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.amqp.messaging.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.