How openagrinet/network-adapter works
Beckn-ONIX is a plugin-based Beckn protocol middleware adapter between buyer and provider platforms. Its main workflow receives HTTP transactions, runs configured processing steps and plugins for validation, routing, security and transformation, then forwards requests or returns responses. Separate catalog publishing and crawling endpoints support catalog distribution and registry synchronization. The README documents several plugin capabilities whose implementations were not sampled; those branches are represented at the documented subsystem level, and their edges cite the README rather than implying source inspection.
Main entry points: step.go Processing steps · main.go Adapter startup · stdHandler.go HTTP handler · module.go Transaction modules
Components 26
Adapter runtime
- Adapter startup
cmd/adapter/main.go - Transaction modules
core/module/module.go
Transaction pipeline
- HTTP handler
core/module/handler/stdHandler.go - Processing steps
core/module/handler/step.go - Response steps
core/module/handler/responsestep.go
Protocol plugins
- Plugin manager
pkg/plugin/manager.go - Request router
pkg/plugin/implementation/router/router.go - Schema validation
pkg/plugin/implementation/schemavalidator - Sign and verify
pkg/plugin/implementation/signvalidator - Key management
pkg/plugin/implementation/keymanager/keymanager.go - Request processing
pkg/plugin/implementation/reqpreprocessor - Response cache
pkg/plugin/implementation/cache/cache.go - Async publisher
pkg/plugin/implementation/publisher/publisher.go - Participant registry
pkg/plugin/implementation/sunbirdRegistry/sunbirdRegistry.go - Policy enforcement
pkg/plugin/implementation/opapolicychecker/enforcer.go - Network manifest
pkg/plugin/implementation/manifestloader/manifestloader.go
Catalog services
- Catalog publishing
pkg/plugin/implementation/catalogpublisher/handler.go - Catalog crawling
pkg/plugin/implementation/catalogcrawler/handler.go - Catalog storage
pkg/plugin/implementation/localcatalogblobstore/localcatalogblobstore.go
Security and observability
- Telemetry and audit
pkg/plugin/implementation/otelsetup/otelsetup.go - Structured logging
pkg/log/log.go
Other components
- BAP / BPP
- HashiCorp Vault
- Redis
- RabbitMQ
- External services
Connections 27
- BAP / BPP → Adapter startup: send HTTP
- Adapter startup → Plugin manager: loads plugins
cmd/adapter/main.go - Adapter startup → Transaction modules: registers modules
cmd/adapter/main.go - Transaction modules → HTTP handler: routes requests
- HTTP handler → Processing steps: runs steps
- HTTP handler → Response steps: runs responses
core/module/handler/stdHandler.go - HTTP handler → External services: forwards requests
core/module/handler/stdHandler.go - Processing steps → Schema validation: validates schema
- Processing steps → Request router: determines route
- Processing steps → Sign and verify: validates signatures
- Processing steps → Request processing: preprocesses requests
- Processing steps → Response cache: caches responses
- Processing steps → Async publisher: publishes messages
- Plugin manager → Key management: constructs plugins
pkg/plugin/manager.go - Key management → HashiCorp Vault: stores keysets
pkg/plugin/implementation/keymanager/keymanager.go - Processing steps → Policy enforcement: checks policy
- Policy enforcement → Network manifest: loads policy manifest
- Processing steps → Participant registry: looks up participants
- Response cache → Redis: uses cache store
- Async publisher → RabbitMQ: publishes messages
- Transaction modules → Catalog publishing: registers endpoint
pkg/plugin/implementation/catalogpublisher/handler.go - Adapter startup → Catalog crawling: registers crawler
cmd/adapter/main.go - Catalog publishing → Catalog storage: stores catalogs
pkg/plugin/implementation/catalogpublisher/handler.go - Catalog publishing → Participant registry: uses registry
pkg/plugin/implementation/catalogpublisher/handler.go - Catalog crawling → Participant registry: crawls registry
- HTTP handler → Telemetry and audit: instruments requests
core/module/handler/stdHandler.go - Adapter startup → Structured logging: logs startup
cmd/adapter/main.go