Search in sources :

Example 11 with FieldTable

use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.

the class ExchangeDeclareBody method process.

public static void process(final QpidByteBuffer buffer, final ServerChannelMethodProcessor dispatcher) throws AMQFrameDecodingException {
    int ticket = buffer.getUnsignedShort();
    AMQShortString exchange = AMQShortString.readAMQShortString(buffer);
    AMQShortString type = AMQShortString.readAMQShortString(buffer);
    byte bitfield = buffer.get();
    boolean passive = (bitfield & 0x1) == 0x1;
    boolean durable = (bitfield & 0x2) == 0x2;
    boolean autoDelete = (bitfield & 0x4) == 0x4;
    boolean internal = (bitfield & 0x8) == 0x8;
    boolean nowait = (bitfield & 0x10) == 0x10;
    FieldTable arguments = EncodingUtils.readFieldTable(buffer);
    if (!dispatcher.ignoreAllButCloseOk()) {
        dispatcher.receiveExchangeDeclare(exchange, type, passive, durable, autoDelete, internal, nowait, arguments);
    }
    if (arguments != null) {
        arguments.clearEncodedForm();
    }
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable)

Example 12 with FieldTable

use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.

the class QueueBindBody method process.

public static void process(final QpidByteBuffer buffer, final ServerChannelMethodProcessor dispatcher) throws AMQFrameDecodingException {
    int ticket = buffer.getUnsignedShort();
    AMQShortString queue = AMQShortString.readAMQShortString(buffer);
    AMQShortString exchange = AMQShortString.readAMQShortString(buffer);
    AMQShortString bindingKey = AMQShortString.readAMQShortString(buffer);
    boolean nowait = (buffer.get() & 0x01) == 0x01;
    FieldTable arguments = EncodingUtils.readFieldTable(buffer);
    if (!dispatcher.ignoreAllButCloseOk()) {
        dispatcher.receiveQueueBind(queue, exchange, bindingKey, nowait, arguments);
    }
    if (arguments != null) {
        arguments.clearEncodedForm();
    }
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable)

Example 13 with FieldTable

use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.

the class QueueDeclareBody method process.

public static void process(final QpidByteBuffer buffer, final ServerChannelMethodProcessor dispatcher) throws AMQFrameDecodingException {
    int ticket = buffer.getUnsignedShort();
    AMQShortString queue = AMQShortString.readAMQShortString(buffer);
    byte bitfield = buffer.get();
    boolean passive = (bitfield & 0x01) == 0x01;
    boolean durable = (bitfield & 0x02) == 0x02;
    boolean exclusive = (bitfield & 0x04) == 0x04;
    boolean autoDelete = (bitfield & 0x08) == 0x08;
    boolean nowait = (bitfield & 0x010) == 0x010;
    FieldTable arguments = EncodingUtils.readFieldTable(buffer);
    if (!dispatcher.ignoreAllButCloseOk()) {
        dispatcher.receiveQueueDeclare(queue, passive, durable, exclusive, autoDelete, nowait, arguments);
    }
    if (arguments != null) {
        arguments.clearEncodedForm();
    }
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable)

Example 14 with FieldTable

use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.

the class QueueUnbindBody method process.

public static void process(final QpidByteBuffer buffer, final ServerChannelMethodProcessor dispatcher) throws AMQFrameDecodingException {
    int ticket = buffer.getUnsignedShort();
    AMQShortString queue = AMQShortString.readAMQShortString(buffer);
    AMQShortString exchange = AMQShortString.readAMQShortString(buffer);
    AMQShortString routingKey = AMQShortString.readAMQShortString(buffer);
    FieldTable arguments = EncodingUtils.readFieldTable(buffer);
    if (!dispatcher.ignoreAllButCloseOk()) {
        dispatcher.receiveQueueUnbind(queue, exchange, routingKey, arguments);
    }
    if (arguments != null) {
        arguments.clearEncodedForm();
    }
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable)

Example 15 with FieldTable

use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.

the class AMQPConnection_0_8Test method testConnectionEnforcesMaxSessions.

public void testConnectionEnforcesMaxSessions() throws Exception {
    AMQPConnection_0_8Impl conn = new AMQPConnection_0_8Impl(_broker, _network, _port, _transport, _protocol, 0, _ticker);
    conn.create();
    conn.receiveProtocolHeader(new ProtocolInitiation(ProtocolVersion.v0_8));
    conn.receiveConnectionStartOk(new FieldTable(), SASL_MECH, SASL_RESPONSE, LOCALE);
    int maxChannels = 10;
    conn.receiveConnectionTuneOk(maxChannels, 65535, 0);
    conn.receiveConnectionOpen(new AMQShortString(VIRTUAL_HOST_NAME), AMQShortString.EMPTY_STRING, false);
    // check the channel count is correct
    int channelCount = conn.getSessionModels().size();
    assertEquals("Initial channel count wrong", 0, channelCount);
    assertEquals("Number of channels not correctly set.", maxChannels, conn.getSessionCountLimit());
    assertFalse("Connection should not be closed after opening " + maxChannels + " channels", conn.isClosing());
    for (long currentChannel = 1L; currentChannel <= maxChannels; currentChannel++) {
        conn.receiveChannelOpen((int) currentChannel);
    }
    assertFalse("Connection should not be closed after opening " + maxChannels + " channels", conn.isClosing());
    assertEquals("Maximum number of channels not set.", maxChannels, conn.getSessionModels().size());
    conn.receiveChannelOpen(maxChannels + 1);
    assertTrue("Connection should be closed after opening " + (maxChannels + 1) + " channels", conn.isClosing());
}
Also used : ProtocolInitiation(org.apache.qpid.server.protocol.v0_8.transport.ProtocolInitiation)

Aggregations

FieldTable (org.apache.qpid.server.protocol.v0_8.FieldTable)20 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)19 Database (com.sleepycat.je.Database)5 DatabaseEntry (com.sleepycat.je.DatabaseEntry)5 Transaction (com.sleepycat.je.Transaction)5 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)4 HashMap (java.util.HashMap)3 UUID (java.util.UUID)3 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)3 ArrayList (java.util.ArrayList)2 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)2 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)2 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)2 Header (org.apache.qpid.server.protocol.v0_10.transport.Header)2 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)2 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)2 ContentHeaderBody (org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody)2 LongBinding (com.sleepycat.bind.tuple.LongBinding)1 TupleBinding (com.sleepycat.bind.tuple.TupleBinding)1 TupleOutput (com.sleepycat.bind.tuple.TupleOutput)1