Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.BasicContentHeaderProperties


    }

    private void sendMessageOnExchange(Exchange directExchange, AMQShortString routingKey, boolean deliveryMode)
    {
        //Set MessagePersustebce
        BasicContentHeaderProperties properties = new BasicContentHeaderProperties();
        properties.setDeliveryMode(deliveryMode ? Integer.valueOf(2).byteValue() : Integer.valueOf(1).byteValue());
        FieldTable headers = properties.getHeaders();
        headers.setString("Test", "MST");
        properties.setHeaders(headers);

        MessagePublishInfo messageInfo = new TestMessagePublishInfo(directExchange, false, false, routingKey);

        IncomingMessage currentMessage = null;
View Full Code Here


            }

            if (ENABLE_JMSXUserID)
            {
                //Set JMSXUserID
                BasicContentHeaderProperties properties = (BasicContentHeaderProperties) contentHeaderBody.properties;
                //fixme: fudge for QPID-677
                properties.getHeaders().keySet();

                properties.setUserId(_session.getAuthorizedID().getName());
            }

            _currentMessage.setContentHeaderBody(contentHeaderBody);

            _currentMessage.setExpiration();
View Full Code Here

        AMQFrame publishFrame = body.generateFrame(_channelId);

        message.prepareForSending();
        ByteBuffer payload = message.getData();
        AMQMessageDelegate_0_8 delegate = (AMQMessageDelegate_0_8) message.getDelegate();
        BasicContentHeaderProperties contentHeaderProperties = delegate.getContentHeaderProperties();

        if (!_disableTimestamps)
        {
            final long currentTime = System.currentTimeMillis();
            contentHeaderProperties.setTimestamp(currentTime);

            if (timeToLive > 0)
            {
                contentHeaderProperties.setExpiration(currentTime + timeToLive);
            }
            else
            {
                contentHeaderProperties.setExpiration(0);
            }
        }

        contentHeaderProperties.setDeliveryMode((byte) deliveryMode);
        contentHeaderProperties.setPriority((byte) priority);

        final int size = (payload != null) ? payload.limit() : 0;
        final int contentBodyFrameCount = calculateContentBodyFrameCount(payload);
        final AMQFrame[] frames = new AMQFrame[2 + contentBodyFrameCount];
View Full Code Here

     */
    public AbstractJMSMessage createMessage(long deliveryTag, boolean redelivered, AMQShortString exchange,
                                            AMQShortString routingKey, ContentHeaderBody contentHeader, List bodies)
            throws AMQException, JMSException
    {
        BasicContentHeaderProperties properties = (BasicContentHeaderProperties) contentHeader.properties;

        // Get the message content type. This may be null for pure AMQP messages, but will always be set for JMS over
        // AMQP. When the type is null, it can only be assumed that the message is a byte message.
        AMQShortString contentTypeShortString = properties.getContentType();
        contentTypeShortString = (contentTypeShortString == null) ? new AMQShortString(
                JMSBytesMessage.MIME_TYPE) : contentTypeShortString;

        MessageFactory mf = _mimeShortStringToFactoryMap.get(contentTypeShortString);
        if (mf == null)
        {
            throw new AMQException(null, "Unsupport MIME type of " + properties.getContentTypeAsString(), null);
        }
        else
        {
            return mf.createMessage(deliveryTag, redelivered, contentHeader, exchange, routingKey, bodies);
        }
View Full Code Here

                destination.getRoutingKey(), // routingKey
                _session.getTicket()); // ticket

        message.prepareForSending();
        ByteBuffer payload = message.getData();
        BasicContentHeaderProperties contentHeaderProperties = message.getContentHeaderProperties();

        if (!_disableTimestamps)
        {
            final long currentTime = System.currentTimeMillis();
            contentHeaderProperties.setTimestamp(currentTime);

            if (timeToLive > 0)
            {
                contentHeaderProperties.setExpiration(currentTime + timeToLive);
            }
            else
            {
                contentHeaderProperties.setExpiration(0);
            }
        }

        contentHeaderProperties.setDeliveryMode((byte) deliveryMode);
        contentHeaderProperties.setPriority((byte) priority);

        final int size = (payload != null) ? payload.limit() : 0;
        final int contentBodyFrameCount = calculateContentBodyFrameCount(payload);
        final AMQFrame[] frames = new AMQFrame[2 + contentBodyFrameCount];
View Full Code Here

    private BasicMessageConsumer _consumer;
    private boolean _strictAMQP;

    protected AbstractJMSMessage(ByteBuffer data)
    {
        super(new BasicContentHeaderProperties());
        _data = data;
        if (_data != null)
        {
            _data.acquire();
        }
View Full Code Here

            isdelivered.add(msg.getDeliveredToConsumer() ? "true" : "false");

//        msg.getMessageHandle();

            BasicContentHeaderProperties headers = null;

            try
            {
                headers = ((BasicContentHeaderProperties) msg.getContentHeaderBody().properties);
            }
            catch (AMQException e)
            {
                //ignore
//                commandError("Unable to read properties for message: " + e.getMessage(), null);
            }

            if (headers != null)
            {
                String appidS = headers.getAppIdAsString();
                appid.add(appidS == null ? "null" : appidS);

                String clusterS = headers.getClusterIdAsString();
                clusterid.add(clusterS == null ? "null" : clusterS);

                String contentS = headers.getContentTypeAsString();
                contenttype.add(contentS == null ? "null" : contentS);

                String correlationS = headers.getCorrelationIdAsString();
                correlationid.add(correlationS == null ? "null" : correlationS);

                deliverymode.add("" + headers.getDeliveryMode());

                AMQShortString encodeSS = headers.getEncoding();
                encoding.add(encodeSS == null ? "null" : encodeSS.toString());

                expiration.add("" + headers.getExpiration());

                FieldTable headerFT = headers.getHeaders();
                msgHeaders.add(headerFT == null ? "none" : "" + headerFT.toString());

                priority.add("" + headers.getPriority());
                propertyflag.add("" + headers.getPropertyFlags());

                AMQShortString replytoSS = headers.getReplyTo();
                replyto.add(replytoSS == null ? "null" : replytoSS.toString());

                timestamp.add("" + headers.getTimestamp());

                AMQShortString typeSS = headers.getType();
                type.add(typeSS == null ? "null" : typeSS.toString());

                AMQShortString useridSS = headers.getUserId();
                userid.add(useridSS == null ? "null" : useridSS.toString());

                MessagePublishInfo info = null;
                try
                {
View Full Code Here

    }

    private String[] getMessageHeaderProperties(ContentHeaderBody headerBody)
    {
        List<String> list = new ArrayList<String>();
        BasicContentHeaderProperties headerProperties = (BasicContentHeaderProperties) headerBody.properties;
        list.add("reply-to = " + headerProperties.getReplyToAsString());
        list.add("propertyFlags = " + headerProperties.getPropertyFlags());
        list.add("ApplicationID = " + headerProperties.getAppIdAsString());
        list.add("ClusterID = " + headerProperties.getClusterIdAsString());
        list.add("UserId = " + headerProperties.getUserIdAsString());
        list.add("JMSMessageID = " + headerProperties.getMessageIdAsString());
        list.add("JMSCorrelationID = " + headerProperties.getCorrelationIdAsString());

        int delMode = headerProperties.getDeliveryMode();
        list.add("JMSDeliveryMode = " + ((delMode == 1) ? "Persistent" : "Non_Persistent"));

        list.add("JMSPriority = " + headerProperties.getPriority());
        list.add("JMSType = " + headerProperties.getType());

        long longDate = headerProperties.getExpiration();
        String strDate = (longDate != 0) ? _dateFormat.format(new Date(longDate)) : null;
        list.add("JMSExpiration = " + strDate);

        longDate = headerProperties.getTimestamp();
        strDate = (longDate != 0) ? _dateFormat.format(new Date(longDate)) : null;
        list.add("JMSTimestamp = " + strDate);

        return list.toArray(new String[list.size()]);
    }
View Full Code Here

    }

    private ContentHeaderBody createPersistentContentHeader()
    {
        ContentHeaderBody chb = new ContentHeaderBody();
        BasicContentHeaderProperties bchp = new BasicContentHeaderProperties();
        bchp.setDeliveryMode((byte)2);
        chb.properties = bchp;
        return chb;
    }
View Full Code Here

            isdelivered.add(entry.getDeliveredToConsumer() ? "true" : "false");

//        msg.getMessageHandle();

            BasicContentHeaderProperties headers = null;

            try
            {
                if(msg instanceof AMQMessage)
                {
                    headers = ((BasicContentHeaderProperties) ((AMQMessage)msg).getContentHeaderBody().getProperties());
                }
            }
            catch (AMQException e)
            {
                //ignore
//                commandError("Unable to read properties for message: " + e.getMessage(), null);
            }

            if (headers != null)
            {
                String appidS = headers.getAppIdAsString();
                appid.add(appidS == null ? "null" : appidS);

                String clusterS = headers.getClusterIdAsString();
                clusterid.add(clusterS == null ? "null" : clusterS);

                String contentS = headers.getContentTypeAsString();
                contenttype.add(contentS == null ? "null" : contentS);

                String correlationS = headers.getCorrelationIdAsString();
                correlationid.add(correlationS == null ? "null" : correlationS);

                deliverymode.add("" + headers.getDeliveryMode());

                AMQShortString encodeSS = headers.getEncoding();
                encoding.add(encodeSS == null ? "null" : encodeSS.toString());

                expiration.add("" + headers.getExpiration());

                FieldTable headerFT = headers.getHeaders();
                msgHeaders.add(headerFT == null ? "none" : "" + headerFT.toString());

                priority.add("" + headers.getPriority());
                propertyflag.add("" + headers.getPropertyFlags());

                AMQShortString replytoSS = headers.getReplyTo();
                replyto.add(replytoSS == null ? "null" : replytoSS.toString());

                timestamp.add("" + headers.getTimestamp());

                AMQShortString typeSS = headers.getType();
                type.add(typeSS == null ? "null" : typeSS.toString());

                AMQShortString useridSS = headers.getUserId();
                userid.add(useridSS == null ? "null" : useridSS.toString());

                MessagePublishInfo info = null;
                try
                {
View Full Code Here

TOP

Related Classes of org.apache.qpid.framing.BasicContentHeaderProperties

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.