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.
import babelqueue "github.com/babelqueue/babelqueue-go"
// body pulled from your broker (Redis BLPOP, AMQP delivery, …)
in, err := babelqueue.Decode(body)
if err != nil || !in.Accepts() {
return // malformed or unsupported — dead-letter / drop
}
switch in.URN() {
case "urn:babel:orders:created":
log.Printf("[%s] order received: %+v", in.TraceID, in.Data)
}
That’s the whole loop: any producer, any consumer, one schema.