Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.ContentHeaderBody


            {
                return null;
            }
        };

        ContentHeaderBody contentHeaderBody = new ContentHeaderBody();
        contentHeaderBody.bodySize = MESSAGE_SIZE;   // in bytes
        contentHeaderBody.properties = new BasicContentHeaderProperties();
        ((BasicContentHeaderProperties) contentHeaderBody.properties).setDeliveryMode((byte) (persistent ? 2 : 1));
        return new AMQMessage(_messageStore.getNewMessageId(), publish, _transactionalContext, contentHeaderBody);
    }
View Full Code Here


            {
                return null;
            }
        };

        ContentHeaderBody contentHeaderBody = new ContentHeaderBody();
        contentHeaderBody.bodySize = size;   // in bytes
        AMQMessage message = new AMQMessage(_messageStore.getNewMessageId(), publish, _transactionalContext);
        message.setContentHeaderBody(contentHeaderBody);
        message.setPublisher(protocolSession);
        return message;
View Full Code Here

        TestMessage(long tag, long messageId, MessagePublishInfo publishBody, TransactionalContext txnContext)
        {
            super(messageId, publishBody, txnContext);
            try
            {
                setContentHeaderBody(new ContentHeaderBody()
                {
                    public int getSize()
                    {
                        return 1;
                    }
View Full Code Here

            if (persistent)
            {
                BasicContentHeaderProperties b = new BasicContentHeaderProperties();
                //This is DeliveryMode.PERSISTENT
                b.setDeliveryMode((byte) 2);
                ContentHeaderBody cb = new ContentHeaderBody();
                cb.properties = b;
                msg.setContentHeaderBody(cb);
            }
            else
            {
                msg.setContentHeaderBody(new ContentHeaderBody());
            }
            // we increment the reference here since we are not delivering the messaging to any queues, which is where
            // the reference is normally incremented. The test is easier to construct if we have direct access to the
            // subscription
            msg.incrementReference();
View Full Code Here

    }

    private ContentHeaderBody convertContentHeaderBody(MessageTransferMessage message, VirtualHost vhost)
    {
        BasicContentHeaderProperties props = convertContentHeaderProperties(message, vhost);
        ContentHeaderBody chb = new ContentHeaderBody(props, BASIC_CLASS_ID);
        chb.setBodySize(message.getSize());
        return chb;
    }
View Full Code Here

        currentMessage = new IncomingMessage(messageInfo);

        currentMessage.setExchange(exchange);

        ContentHeaderBody headerBody = new ContentHeaderBody(BasicConsumeBodyImpl.CLASS_ID,0,properties,0l);

        try
        {
            currentMessage.setContentHeaderBody(headerBody);
        }
View Full Code Here

        for (int count = 0; count < numberOfMessages; count++)
        {
            channel.setPublishFrame(info, destination);

            // Set the body size
            ContentHeaderBody _headerBody = new ContentHeaderBody();
            _headerBody.setBodySize(0);

            // Set Minimum properties
            BasicContentHeaderProperties properties = new BasicContentHeaderProperties();

            properties.setExpiration(0L);
            properties.setTimestamp(System.currentTimeMillis());

            // Make Message Persistent
            properties.setDeliveryMode((byte) 2);

            _headerBody.setProperties(properties);

            channel.publishContentHeader(_headerBody);
        }
        channel.sync();
    }
View Full Code Here

        AMQChannel channel = new AMQChannel(_protocolSession, 1, _virtualHost.getMessageStore());
        channel.setLocalTransactional();

        MessagePublishInfo info = mock(MessagePublishInfo.class);
        ExchangeImpl e = mock(ExchangeImpl.class);
        ContentHeaderBody contentHeaderBody= mock(ContentHeaderBody.class);
        BasicContentHeaderProperties properties = mock(BasicContentHeaderProperties.class);

        when(contentHeaderBody.getProperties()).thenReturn(properties);
        when(info.getExchange()).thenReturn(new AMQShortString("test"));
        when(properties.getUserId()).thenReturn(new AMQShortString(_protocolSession.getAuthorizedPrincipal().getName() + "_incorrect"));

        channel.setPublishFrame(info, e);
        channel.publishContentHeader(contentHeaderBody);
View Full Code Here

        AMQChannel channel = new AMQChannel(_protocolSession, 1, _virtualHost.getMessageStore());
        channel.setLocalTransactional();

        MessagePublishInfo info = mock(MessagePublishInfo.class);
        ExchangeImpl e = mock(ExchangeImpl.class);
        ContentHeaderBody contentHeaderBody= mock(ContentHeaderBody.class);
        BasicContentHeaderProperties properties = mock(BasicContentHeaderProperties.class);

        when(contentHeaderBody.getProperties()).thenReturn(properties);
        when(info.getExchange()).thenReturn(new AMQShortString("test"));
        when(properties.getUserId()).thenReturn(new AMQShortString(_protocolSession.getAuthorizedPrincipal().getName()));

        channel.setPublishFrame(info, e);
        channel.publishContentHeader(contentHeaderBody);
View Full Code Here

    /**
     * Check that when the reference count is decremented the message removes itself from the store
     */
    public void testMessageGetsRemoved() throws AMQException
    {
        ContentHeaderBody chb = createPersistentContentHeader();

        MessagePublishInfo info = new MessagePublishInfo()
        {

            public AMQShortString getExchange()
View Full Code Here

TOP

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

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.