Redis Streams · Example Payload

Redis Xadd Example

XADD command — append a new entry to a stream

Consumer GroupsEvent-DrivenIn-MemoryMessagingRedisStreaming

Redis Xadd Example is an example object payload from Redis Streams, with 6 top-level fields. It illustrates the shape of data this provider's APIs accept or return.

Top-level fields

descriptioncommandexplanationresponseresponse_descriptionprogrammatic_example

Example Payload

redis-xadd-example.json Raw ↑
{
  "description": "XADD command — append a new entry to a stream",
  "command": "XADD mystream * sensor_id sensor-001 temperature 23.5 humidity 60",
  "explanation": "Appends a new entry to the stream 'mystream' with an auto-generated ID (* means auto). The entry has three fields: sensor_id, temperature, and humidity.",
  "response": "1526919030474-55",
  "response_description": "The auto-generated entry ID in <milliseconds>-<sequence> format.",
  "programmatic_example": {
    "language": "python",
    "code": "import redis\nr = redis.Redis(host='localhost', port=6379)\nentry_id = r.xadd('mystream', {'sensor_id': 'sensor-001', 'temperature': '23.5', 'humidity': '60'})\nprint(entry_id)  # b'1526919030474-55'"
  }
}