Skip to main content

argo-ams-library

Jenkins Build Status

A simple python library for interacting with the ARGO Messaging Service.

The Messaging Services is implemented as a Publish/Subscribe Service. Instead of focusing on a single Messaging API specification for handling the logic of publishing/subscribing to the broker network the API focuses on creating nodes of Publishers and Subscribers as a Service.

In the Publish/Subscribe paradigm, Publishers are users/systems that can send messages to named-channels called Topics. Subscribers are users/systems that create Subscriptions to specific topics and receive messages.

You may find more information about the ARGO Messaging Service documentation

Library installation

Library is tested and should work with Python versions 3.6, 3.8, 3.9, 3.10, 3.11 running on Rocky 8 and Rocky 9 releases.

RPM packages are prepared for Rocky releases and you may find it and download it from ARGO Repository. PyPI packages are prepared as well.

RPM production packages:

RPM devel packages:

PyPI package:

https://pypi.org/project/argo-ams-library/

Authentication

The AMS library uses a valid AMS token to execute requests against the AMS cluster. This token can be provided with 2 ways:

  • Obtain a valid ams token and then use it when initializing the ams object.
from argo_ams_library import ArgoMessagingService
ams = ArgoMessagingService(endpoint="ams_endpoint", project="ams_project", token="your_ams_token")
  • Use a valid certificate
from argo_ams_library import ArgoMessagingService
ams = ArgoMessagingService(endpoint="ams_endpoint", project="ams_project", cert="/path/to/cert", key="/path/to/cert/key")

The library will use the provided certificate to access the corresponding ams token through the ARGO Authentication Service and then set the ams object's token field with the retrieved token.

Examples

In the folder examples, you may find examples of using the library:

  • for publishing messages (examples/publish.py)
  • for consuming messages in pull mode (examples/consume-pull.py)
  • retry feature for publish/consume methods (examples/retry.py)

Publish messages

This example explains how to publish messages in a topic with the use of the library. Topics are resources that can hold messages. Publishers (users/systems) can create topics on demand and name them (Usually with names that make sense and express the class of messages delivered in the topic). A topic name must be scoped to a project.

You may find more information about Topics in the ARGO Messaging Service documentation

publish.py  --host=[the FQDN of AMS Service]
--token=[the user token]
--project=[the name of your project registered in AMS Service]
--topic=[the topic to publish your messages]

Consume messages in pull mode

This example explains how to consume messages from a predefined subscription with the use of the library. A subscription is a named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application. A subscription name must be scoped to a project. In pull delivery, your subscriber application initiates requests to the Pub/Sub server to retrieve messages. When you create a subscription, the system establishes a sync point. That is, your subscriber is guaranteed to receive any message published after this point. Messages published before the sync point may not be delivered.

You may find more information about Subscriptions in the ARGO Messaging Service documentation

consume-pull.py  --host=[the FQDN of AMS Service]
--token=[the user token]
--project=[the name of your project registered in AMS Service]
--topic=[the topic from where the messages are delivered ]
--subscription=[the subscription name to pull the messages]
--nummsgs=[the num of messages to consume]

Retry

Library has self-implemented HTTP request retry ability to seamlesssly interact with the ARGO Messaging service. Specifically, requests will be retried in case of:

  • timeouts from AMS (HTTP 408) or load balancer (HTTP 408 and 504)
  • load balancer HTTP 502, 503
  • connection related problems in the lower network layers

It has two modes: static sleep and backoff. Examples are given in the in examples/retry.py.

Metadata

Release files for argo-ams-library 1.0.0

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

Source distribution (sdist)

Source distribution for argo-ams-library 1.0.0
File Size Uploaded
argo-ams-library-1.0.0.tar.gz 23.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for argo-ams-library 1.0.0
File Interpreter ABI Platform
argo_ams_library-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.0 kB

Release files / argo-ams-library-1.0.0.tar.gz

Download URL argo-ams-library-1.0.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
822206de09f58b65785e0ba8c1e63a839606bcebe4f025cf93d80551cd555c8d
BLAKE2b-256 checksum
How to use checksums
0ce408888e25647905aa22f5a9b28e3b7ff61e7de35624182f294aaf4ba39834
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2

Release files / argo_ams_library-1.0.0-py3-none-any.whl

Download URL argo_ams_library-1.0.0-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68ac860509983cc1252f4b68d402de1487aaf9a95b56e9cadeffb4bc79ad18fd
BLAKE2b-256 checksum
How to use checksums
e0cb80843d15423ce15df58412bed7e97b133d91f47a6ef3015b0112e9901cb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

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