Skip to main content

microservicebus-py

General

To avoid blocking the thread, avoid using the print(...) function. Instead use the built-in printf function inherited from base_service:

self.printf("Hello world")

You can also use self.Debug if you want the logging transmitted to msb.com.

BaseService (base_service)

All services inherit from BaseService either directly or through CustomService. Inheriting from BaseService provides a number of functions such as self.Debug(text) and self.SubmitMessage(message). Such methods are predefined to target specific destinations and functions. A service can also call self.SubmitAction(destination, action, message) when more flexibility is needed.

For instance, if you had a custom service called emailhandler which would send emails through the Process function you could use the following code:

message = {'to':'foo@bar.com', 'subject':'Hello', 'body':'...from foo'}
await self.SubmitAction("emailhandler", "Process", message)

Note that the action is set to "Process". All services inheriting from BaseService has a Start. Stop and Proccess function. However, you could have created a SendEmail function and set the action to "SendEmail".

If, on the other hand, you'd like to send a message to the IoT Hub you would set the destination to "com". However, there is already a simplified function called SubmitMessage predefined with both destination and action:

message = {'ts':'2021-01-01 01:01:01', 'temperature':22}
await self.SubmitMessage(message)

Similarly there is a predefined function to logging:

await self.Debug("Hello from Python")

Internal services

Internal services are used as any other service but are never stopped.

Orchestrator (orchestrator_service)

The Orchestrator is responsible for starting up services and correlate messages between then. All messages on the queue are of type QueueMessage (baseservice) and contains information such as the destination and action. When the Orchestrator receives a message on the queue, it will resolve the destination and call the function (_action).

microServiceBusHandler (msb_handler)

As the name implies the microServiceBusHandler is responsible for all communication with microServiceBus.com. When staring up the service will sign in to msb.com and set up channels for different commands in msb. After successful sign-in, the service will call the Orchestrator to start up the these services.

Logger (logger_service)

The Logger service outputs data to the terminal and forward debugging info to microServiceBusHandler if enabled

Custom services

All custom services inherit from BaseService and must expose the following functions:

Start

The Start function will be called when the when custom service is started. This is the where the services should start any kind of interval or work to produce readings.

Readings can be submitted using the self.SubmitMessage(message) function which forwards the message to the Process function of the Com service.

Stop

The Stop function is called as the service is getting stopped and can be used for any cleanup.

Process

The Process method can optionally be used for transmitting messages between services using the self.SubmitAction(destination, action, message) E.g

await self.SubmitAction('MyOtherService', 'Process', message)

StateUpdate

State updates received by the Com service are forwarded to all services and accessible through the StateUpdate function

Metadata

Release files for microservicebus-py 1.0.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microservicebus-py 1.0.18
File Size Uploaded Provenance Actions
microservicebus-py-1.0.18.tar.gz 21.8 kB Without provenance Details for microservicebus-py-1.0.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for microservicebus-py 1.0.18
File Interpreter ABI Platform Actions
microservicebus_py-1.0.18-py3-none-any.whl Python 3 none any Details for microservicebus_py-1.0.18-py3-none-any.whl

Total release size: 64.5 kB

Release files / microservicebus-py-1.0.18.tar.gz

Download URL microservicebus-py-1.0.18.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
308149e14548ef4918dc2d6a105bbcf11c987e4cc95e780c7d2f3a3587aa3139
BLAKE2b-256 checksum
How to use checksums
4806e8f8c7e0de4ba0386f8a4425eb8f1237d7f2ddfb0df275bfb6dcd124e3ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release files / microservicebus_py-1.0.18-py3-none-any.whl

Download URL microservicebus_py-1.0.18-py3-none-any.whl
Size 42.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3eac823244d36e838bdba259013b02b868b857009842c717f6be90469833378b
BLAKE2b-256 checksum
How to use checksums
e350727ac6ab35a6f0e227049fdadab9e146d7470eff86dd8a97cfe468c547bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Security for microservicebus-py 1.0.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.18 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page