Skip to main content

Publishing

The HTTP events ingester publishes the body of the request.

What it takes​

By Content-Type:

Content typeIs
application/cloudevents+jsonone structured event
application/cloudevents-batch+jsona JSON array of structured events
anything elseone event in binary mode: the body is its data, the content type is its datacontenttype (charset included), its attributes come from ce- headers (ce-id, ce-type, ce-source, ce-subject, ce-<extension>)
application/vnd.cloud-apim-event-broker+jsonthe format of the extension before CloudEvents, still read

A chunked body (or the lines=true option) is read line by line, each line one event. What a request does not say is filled in: a fresh id, /otoroshi/routes/<route id> as source (or the source option), com.cloud-apim.event-brokers.event as type (or the type option), now as time.

What it answers​

One JSON line per event, in order, with the id of the event, once the broker has taken it or refused it:

{"published": true, "id": "4f1c...", "details": {"topic": "orders", "partition": 0, "offset": 42}}
{"published": false, "id": "77ab...", "error": "publish_error", "error_description": "no queue got the message: ..."}
{"published": false, "error": "invalid_event", "error_description": "source is required"}

A broker refusing one event does not fail the others. What the details say:

BrokerDetails
Kafkatopic, partition, offset
Pulsartopic, message_id
RabbitMQthe broker's confirm; a message no queue gets is a failed result, not dropped in silence
Redis pub/subchannel, and how many subscribers got the message (receivers)
Redis streamsstream, the id of the entry
MQTTtopic
Artemisaddress, routing_type, its JMS message_id

A body that is not valid at all is refused with a 400.

Options​

Option
topicwhere to (queue, exchange and routing_key on RabbitMQ, channel or stream on Redis, address on Artemis)
key, partitionKafka (an event's partitionkey extension is its key on every broker with keys)
qos, retainedMQTT
routing_type, key, priority, ttl, delay, deliver_at, durableArtemis
source, type, subjectthe attributes the request does not give
linesread the body line by line

Events are published in batches of up to 100 (or what came within 10 ms), in order.