Metadata-Version: 2.4
Name: pubsublib
Version: 0.1.22
Summary: The Python Adaptation of the PubSubLib for Orange Health
Project-URL: Homepage, https://github.com/Orange-Health/pubsublib-python
Project-URL: Issues, https://github.com/Orange-Health/pubsublib-python/issues
Project-URL: Repository, https://github.com/Orange-Health/pubsublib-python
Author-email: Anant Chauhan <anant.chauhan@orangehealth.in>, Rajendra Talekar <talekar.r@gmail.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# pubsublib

pubsublib is a Python library designed for PubSub functionality using AWS - SNS & SQS.

## PIP Package
[pubsublib](https://pypi.org/project/pubsublib/)

## Getting Started
To get started with pubsublib, you can install it via pip:

```bash
pip install pubsublib
```

## Using Pubsublib
Once pubsublib is installed, you can use it in your Python code as follows:

```python
from pubsublib.aws.main import AWSPubSubAdapter

pubsub_adapter = AWSPubSubAdapter(
    aws_region='XXXXX',
    aws_access_key_id='XXXXX',
    aws_secret_access_key='XXXXX',
    redis_location='XXXXX',
    sns_endpoint_url=None,
    sqs_endpoint_url=None
)
```

#### Using AWS IAM Roles for Service Accounts 

When using IAM Roles for Service Accounts (IRSA), pass `aws_access_key_id` and `aws_secret_access_key` as empty strings so that the AWS SDK uses its default credential provider chain (which will pick up the service account role). You should still provide a valid `aws_region` here, or ensure that `AWS_REGION` or `AWS_DEFAULT_REGION` is set in the environment or shared AWS config when omitting it.

#### SQS server-side encryption (SSE-SQS)

Optional adapter setting — **off by default**, fully backward compatible. Existing `AWSPubSubAdapter(...)` calls work unchanged.

```python
pubsub_adapter = AWSPubSubAdapter(
    aws_region='ap-south-1',
    aws_access_key_id='',
    aws_secret_access_key='',
    redis_location='redis://localhost:6379/0',
    sqs_managed_sse_enabled=True,  # optional; omit or pass False to keep current behaviour
)
```

All `create_queue` calls on that adapter then set `SqsManagedSseEnabled=true`. If the queue already exists, SSE is applied via `SetQueueAttributes`. You can also toggle at runtime with `set_sqs_managed_sse_enabled(True)`.

[Steps to Publish Package](https://github.com/Orange-Health/pubsublib-python/wiki/PyPI-%7C-Publish-Package#steps-to-publish-the-pubsublib-package-on-pypi)

