Example usage for com.rabbitmq.client.impl MethodArgumentWriter writeTable

List of usage examples for com.rabbitmq.client.impl MethodArgumentWriter writeTable

Introduction

In this page you can find the example usage for com.rabbitmq.client.impl MethodArgumentWriter writeTable.

Prototype

public final void writeTable(Map<String, Object> table) throws IOException 

Source Link

Document

Public API - encodes a table argument.

Usage

From source file:uk.trainwatch.rabbitmq.RabbitMQ.java

License:Apache License

/**
 * Convert a map to an AMQP table/*w w  w  .  j a va 2  s . co  m*/
 *
 * @param args
 *
 * @return
 */
public static byte[] toAMQPTable(Map<String, Object> args) {
    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        MethodArgumentWriter writer = new MethodArgumentWriter(new ValueWriter(new DataOutputStream(buffer)));

        writer.writeTable(fixAMQPTable(args));
        writer.flush();
        return buffer.toByteArray();
    } catch (IOException ex) {
        throw new UncheckedIOException(ex);
    }
}