Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.ContentHeaderBody


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

            // 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


     */
    static void deliver(int count, List<AMQQueue> queues) throws AMQException
    {
        BasicPublishBody publish = new BasicPublishBody();
        publish.exchange = new NullExchange().getName();
        ContentHeaderBody header = new ContentHeaderBody();
        List<ContentBody> body = new ArrayList<ContentBody>();
        MessageStore messageStore = new SkeletonMessageStore();
        // channel can be null since it is only used in ack processing which does not apply to this test
        TransactionalContext txContext = new NonTransactionalContext(messageStore, null,
                                                                     new LinkedList<RequiredDeliveryException>());
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

        assertEquals(1, _store.getMessageMetaDataMap().size());
    }

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

                return null;
            }
        };

        final Long messageId = _store.getNewMessageId();
        final ContentHeaderBody chb = createPersistentContentHeader();
        AMQMessageHandle messageHandle = (new MessageHandleFactory()).createMessageHandle(messageId, _store, true);
        messageHandle.setPublishAndContentHeaderBody(_storeContext,info,chb);
        AMQMessage message = new AMQMessage(messageHandle,
                                             _storeContext,
                                            info);
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
            ArrayList<AMQQueue> qs = new ArrayList<AMQQueue>();
View Full Code Here

                                                                                                   false);
        try
        {
            amqMessageHandle.setPublishAndContentHeaderBody(new StoreContext(),
                                                              publishBody,
                                                              new ContentHeaderBody()
            {
                public int getSize()
                {
                    return 1;
                }
View Full Code Here

        _messageStore = messageStore;
    }

    public ContentHeaderBody getContentHeaderBody(StoreContext context) throws AMQException
    {
        ContentHeaderBody chb = (_contentHeaderBody != null ? _contentHeaderBody.get() : null);
        if (chb == null)
        {
            MessageMetaData mmd = loadMessageMetaData(context);
            chb = mmd.getContentHeaderBody();
        }
View Full Code Here

            stmt.setString(2, mmd.getMessagePublishInfo().getExchange().toString());
            stmt.setString(3, mmd.getMessagePublishInfo().getRoutingKey().toString());
            stmt.setShort(4, mmd.getMessagePublishInfo().isMandatory() ? (short) 1 : (short) 0);
            stmt.setShort(5, mmd.getMessagePublishInfo().isImmediate() ? (short) 1 : (short) 0);

            ContentHeaderBody headerBody = mmd.getContentHeaderBody();
            final int bodySize = headerBody.getSize();
            byte[] underlying = new byte[bodySize];
            ByteBuffer buf = ByteBuffer.wrap(underlying);
            headerBody.writePayload(buf);
/*
            Blob dataAsBlob = conn.createBlob();
            dataAsBlob.setBytes(1L, underlying);
            stmt.setBlob(6, dataAsBlob);
*/
 
View Full Code Here

        {
            // Create the tabular list of message header contents
            for (int i = beginIndex; (i <= endIndex) && (i <= list.size()); i++)
            {
                AMQMessage msg = list.get(i - 1).getMessage();
                ContentHeaderBody headerBody = msg.getContentHeaderBody();
                // Create header attributes list
                String[] headerAttributes = getMessageHeaderProperties(headerBody);
                Object[] itemValues = { msg.getMessageId(), headerAttributes, headerBody.bodySize, msg.isRedelivered() };
                CompositeData messageData = new CompositeDataSupport(_messageDataType, _msgAttributeNames, itemValues);
                _messageList.put(messageData);
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.