Example usage for com.rabbitmq.client UnexpectedFrameError UnexpectedFrameError

List of usage examples for com.rabbitmq.client UnexpectedFrameError UnexpectedFrameError

Introduction

In this page you can find the example usage for com.rabbitmq.client UnexpectedFrameError UnexpectedFrameError.

Prototype

public UnexpectedFrameError(Frame frame, int expectedFrameType) 

Source Link

Usage

From source file:de.htwk_leipzig.bis.connection.handshake.clientRewrite.CommandAssembler.java

License:Mozilla Public License

private void consumeMethodFrame(Frame f) throws IOException {
    if (f.type == AMQP.FRAME_METHOD) {
        this.method = AMQImpl.readMethodFrom(f.getInputStream());
        this.state = this.method.hasContent() ? CAState.EXPECTING_CONTENT_HEADER : CAState.COMPLETE;
    } else {/*  www.ja v a  2  s  .  c  o m*/
        throw new UnexpectedFrameError(f, AMQP.FRAME_METHOD);
    }
}

From source file:de.htwk_leipzig.bis.connection.handshake.clientRewrite.CommandAssembler.java

License:Mozilla Public License

private void consumeHeaderFrame(Frame f) throws IOException {
    if (f.type == AMQP.FRAME_HEADER) {
        this.contentHeader = AMQImpl.readContentHeaderFrom(f.getInputStream());
        this.remainingBodyBytes = this.contentHeader.getBodySize();
        updateContentBodyState();/*from w  ww  .j  a va 2  s  .  com*/
    } else {
        throw new UnexpectedFrameError(f, AMQP.FRAME_HEADER);
    }
}

From source file:de.htwk_leipzig.bis.connection.handshake.clientRewrite.CommandAssembler.java

License:Mozilla Public License

private void consumeBodyFrame(Frame f) {
    if (f.type == AMQP.FRAME_BODY) {
        byte[] fragment = f.getPayload();
        this.remainingBodyBytes -= fragment.length;
        updateContentBodyState();/*w w  w. j  a v a 2s.  co m*/
        if (this.remainingBodyBytes < 0) {
            throw new UnsupportedOperationException("%%%%%% FIXME unimplemented");
        }
        appendBodyFragment(fragment);
    } else {
        throw new UnexpectedFrameError(f, AMQP.FRAME_BODY);
    }
}