vaizard / glued-integrations
Integrations manager.
dev-main
2024-11-12 17:05 UTC
Requires
- php: ^8.3
- ext-apcu: *
- ext-bcmath: *
- ext-curl: *
- ext-gd: *
- ext-gmp: *
- ext-imap: *
- ext-json: *
- ext-mbstring: *
- ext-mysqli: *
- ext-pdo: *
- ext-pdo_pgsql: *
- ext-readline: *
- ext-soap: *
- ext-xml: *
- league/openapi-psr7-validator: ^0.22.0
- nyholm/psr7: ^1
- nyholm/psr7-server: *
- php-di/php-di: ^7
- psr/http-message: ^1
- ramsey/uuid: ^4
- sabre/event: ^6
- slim/http: ^1
- slim/slim: ^4
- vaizard/glued-lib: dev-main
- zeuxisoo/slim-whoops: ^0.7
Requires (Dev)
Suggests
- ext-xdebug: For dev only
This package is auto-updated.
Last update: 2024-12-12 17:16:28 UTC
README
IF is Glued's integration framework, message queue and scheduler.
Implementation Overview:
if microservice
is a set of methods implemented as a separate git projectglued-if-service_name
to interact with a foreign servicedeployment
is a configuration and authorization context of anif microservice
defined by a row/object of theif__deployments
tableaction
is adeployment:microservice.method
map stored as a row in theif__actions
table. actions are triggered by calling an API endpoint (webhook) or by the IF scheduler.action state
makes a stateful history usingif__actions_states
scheduler
is implemented as a set of cron-like rules with some extra sugarcoating (i.e. ttl) stored in theif__scheduler
table and an associated producer that will periodically fill up themessage queue
with work and runner daemons that will subscribe to this queue and launch workers (perform the webhook api calls)message queue
is implemented as theif__mq_queue
table configuring message queues clients can subscribe to.messages
are implemented as theif__mq_messages
table which maps a queue to a message payload and message headers (i.e. ttl, requesting, replies, etc.)notifications
are implemented using the pg_notify capabilities and can be further extended with rabbitmq.logging
is by default implemented using the monolog library.
Integrations
IF orchestrates if microservices
which facilitate integration with anything thats out there.
- Each
if microservice
implements working with a remote/externalservice
. - Each
if microservice
has associateddeployments
(a set of attributes describing usage of anif microservice
), i.e:- deployment metadata (i.e. name, description, etc.)
- deployment connection (i.e. remote host, auth tokens, rate limits, etc.)
- deployment RBAC rules* (i.e. who can use the if microservice)
- Methods implemented by an
if microservice
(i.e. CRUD operations against an external service) are associated to deployments asactions
(actions are if microservice methods runnable in the context of a deployment configuration). actions- can run on-demand (i.e. provide a caching data transforming interface to external services such as glued-if-ares_gov_cz)
- can run according to a schedule (by the scheduler)
- can interact with each other (via the message queue)
*) RBAC is provided by glued-core's authorization proxy
Scheduler
tbd
Message queue
The message queue is loosely inspired by RabbitMQ to enable an easy transition between the builtin PostgreSQL based queue and Rabbit. The indented MQ usage is
- to distribute scheduled tasks to workers,
- to facilitate communication between the loosely coupled microservices
- to ensure internal notifications to users are send and individually delivered (with or without user confirmation)
IFMQ, when acting as a RabbitMQ-like message brooker, implements the concepts of
producers
/ code responsible for generating messages - php implementation is part of glued-libqueues
/ 'message destinations' implemented via theif__queues
tableconsumers
/ clients subscribed to queuesexchanges
/ code responsible for delivering messages to queues - direct (unicast), fanout (multicast), header (rule based multicast)
Messges can be