LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Active Consumer

When using the active consumer, the backend API/APP has full control over the consumption. The most simple process consists of three steps below. There are more endpoints for the position control and assignment and might be used by the backend API/APP.

Consumer Group

The first step is to create a consumer group with the following command.

curl -k --location --request POST 'https://localhost:8443/consumers/testgroup' \
--header 'Content-Type: application/json' \
--data-raw '{"format": "jsonschema"}'

Result:

{"instance_id":"rest-consumer-id-11179f13-917f-44d6-91d9-da70a57b379e","base_uri":"/consumers/testgroup/instances/rest-consumer-id-11179f13-917f-44d6-91d9-da70a57b379e"}

Subscribe

The second step is to subscribe to one or more topics with the previous command’s returned instance.

curl -k --location --request POST 'https://localhost:8443/consumers/testgroup/instances/rest-consumer-id-b92658a0-bc9c-4907-91e0-7c0d70e9fe68/subscriptions' \
--header 'Content-Type: application/json' \
--data-raw '{
  "topics": [
    "test1"
   ]
}'

There is no response body for this request.

Records

The third step is to retrieve the records.

curl -k https://localhost:8443/consumers/testgroup/instances/rest-consumer-id-b92658a0-bc9c-4907-91e0-7c0d70e9fe68/records?format=jsonschema

Result:

[{"topic":"test1","key":"alice","value":{"count":2},"partition":0,"offset":495738},{"topic":"test1","key":"john","value":{"count":1},"partition":0,"offset":495739},{"topic":"test1","key":"alex","value":{"count":2},"partition":0,"offset":495740}]

Commit

Offset

  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“Active Consumer” was last updated: November 3, 2021: fixes #307 update service document for http-sdiecar and kafka-sidecar (3fcb1ff)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute