--- title: "Consuming messages" description: "Consuming messages — Java BabelQueue SDK (1.x)." source: https://babelqueue.com/docs/babelqueue-java/1.x/consuming-messages/ updated: 2026-06-06T00:00:00.000Z --- # Consuming messages Pull the bytes from your broker, `decode` them, gate with `accepts`, then switch on the URN — regardless of which language produced the message. `traceId()` carries the cross-service correlation id. ```java import com.babelqueue.*; // body pulled from your broker (a Jedis BLPOP, an AMQP delivery, …) Envelope in = EnvelopeCodec.decode(body); if (EnvelopeCodec.accepts(in)) { switch (EnvelopeCodec.urn(in)) { case "urn:babel:orders:created" -> log.info("[{}] order received: {}", in.traceId(), in.data()); default -> { /* unknown URN */ } } } ``` That's the whole loop: any producer, any consumer, one schema.