The WebSub module implements MOSIP’s publish–subscribe messaging model, enabling secure, scalable, and efficient event distribution across services. It provides:
- Topic registration
- Publish/Subscribe operations
- Message persistence and recovery
- Subscriber retry handling
- OAuth2/JWT-based authentication
- Kafka-backed scalability
For more information, refer to the MOSIP WebSub documentation.
- Register, publish, subscribe, unsubscribe operations
- Persistent state storage
- Delivery retries on subscriber failures
- Authentication & authorization via IdP
- Kafka-based horizontal scalability
Uses:
- TLS/SSL
- OAuth2
- JWT-based validation
- IdP-backed authentication
- Hub Service – Event distributor
- Event Consolidator – Aggregates and manages events
- Ballerina (latest)
- Apache Kafka
- Identity Provider (IdP)
- Docker (optional)
SECURITY_ON = true
KAFKA_BOOTSTRAP_NODE = "kafka.${kafka.profile}:${kafka.port}"
REGISTERED_WEBSUB_TOPICS_TOPIC = "registered-websub-topics"
CONSOLIDATED_WEBSUB_TOPICS_TOPIC = "consolidated-websub-topics"
WEBSUB_SUBSCRIBERS_TOPIC = "registered-websub-subscribers"
CONSOLIDATED_WEBSUB_SUBSCRIBERS_TOPIC = "consolidated-websub-subscribers"
META_TOPICS = "registered-websub-topics,consolidated-websub-topics,registered-websub-subscribers,consolidated-websub-subscribers"
SERVER_ID = "server-1"
HUB_PORT = 9191
MESSAGE_DELIVERY_RETRY_INTERVAL = 3.0
MESSAGE_DELIVERY_COUNT = 3
MESSAGE_DELIVERY_TIMEOUT = 60.0
MOSIP_AUTH_BASE_URL = "${mosip.kernel.authmanager.url}/v1/authmanager"
MOSIP_AUTH_VALIDATE_TOKEN_URL = "/authorize/admin/validateToken"
./bin/zookeeper-server-start.sh config/zookeeper.properties
./bin/kafka-server-start.sh config/server.propertiesConfigure the two auth URLs in WebSub config.
docker pull mosipdev/consolidator-websub-service
docker run -e consolidator_config_file_url_env=<config-url> ...cd consolidator
bal build
bal run target/bin/consolidator.jardocker pull mosipdev/websub-service
docker run -e hub_config_file_url_env=<config-url> ...cd hub
bal build
bal run target/bin/hub.jarAfter setup, use the kernel-websubclient-api to interact with the Hub.
Clients may register topics using the WebSub client API.
Performs intent verification and content validation automatically.
Validated content is delivered to subscribers with retry mechanisms.
WebSub creates:
registered-websub-topics
consolidated-websub-topics
registered-websub-subscribers
consolidated-websub-subscribers
Check:
kafka-topics.sh --list --bootstrap-server localhost:9092 | grep <topic>grep "Received publish message" | grep <topic>kafka-console-consumer.sh --topic consolidated-websub-subscribers --from-beginning --bootstrap-server localhost:9092grep <callback-url> | grep <topic>kafka-consumer-groups.sh --describe --group <group> --bootstrap-server localhost:9092If lag exists and subscriber returns non-200 status, it becomes inactive.
- WebSub Docs: https://nayakrounak.gitbook.io/mosip-docs/modules/websub
- API Client: https://github.com/mosip/commons/tree/master/kernel/kernel-websubclient-api
- Code contributions: https://docs.mosip.io/1.2.0/community/code-contributions
- Community portal: https://community.mosip.io/
- Issues: https://github.com/mosip/websub/issues
Licensed under Mozilla Public License 2.0.
