stompypy


Namestompypy JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/hugobrilhante/stompypy
SummaryThe StompyPy is a simple implementation of the STOMP (Simple Text Oriented Messaging Protocol) protocol. It provides an easy way to connect to and exchange STOMP frames with a STOMP server.
upload_time2024-03-04 17:43:19
maintainer
docs_urlNone
authorHugo Brilhante
requires_python>=3.12,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # StompyPy <img src="https://github.com/hugobrilhante/stomppy/blob/main/docs/images/stompypy.png" width=35 height=35 />

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=alert_status)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=security_rating)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=bugs)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=code_smells)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=ncloc)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=coverage)](https://sonarcloud.io/summary/new_code?id=hugobrilhante_stompypy)
[![PyPI version](https://badge.fury.io/py/stompypy.svg)](https://badge.fury.io/py/stompypy)
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/https://github.com/hugobrilhante/stompypy/blob/main/LICENSE)
[![Downloads](https://static.pepy.tech/badge/stompypy)](https://pepy.tech/project/stompypy)

The stompypy is a simple implementation of the STOMP (Simple Text Oriented Messaging Protocol) protocol. It provides an easy way to connect to and exchange STOMP frames with a STOMP server.

## Installation

To install the stompypy package, you can use pip:

```shell
pip install stompypy
```

## Usage Example 🚀

Here's an example demonstrating how to use the `Stomp` class to interact with a STOMP server:

```python
import time

from stompypy import Listener
from stompypy import Stomp


class MyListener(Listener):
    def on_disconnect(self):
        print('Disconnected')

    def on_connect(self):
        print('Connected')

    def on_message(self, frame) -> None:
        print('Message:', frame.body)


if __name__ == '__main__':
    # Create a STOMP connection to the server
    connection = Stomp.create_connection(host='localhost', port=61613)

    # Add listener
    connection.add_listener(MyListener())

    # Connect to the STOMP server
    connection.connect()

    # Subscribe to a destination
    connection.subscribe(id='1', destination='/queue/example', ack_mode='auto')

    # Send a message to the destination
    connection.send(destination='/queue/example', content_type='text/plain', body=f'Hello World!')

    time.sleep(1)

    # Disconnect from the server
    connection.disconnect()
```

## Methods of the Stomp Class 🛠️

- `ack(message_id: str, transaction: Optional[str] = None) -> None`: Sends an ACKNOWLEDGE command to confirm receipt of a message.
- `abort(transaction: str) -> None`: Sends an ABORT command to roll back a transaction.
- `begin(transaction: str) -> None`: Sends a BEGIN command to start a transaction.
- `commit(transaction: str) -> None`: Sends a COMMIT command to confirm a transaction.
- `connect(host: Optional[str] = '/', accept_version: str = '1.2', login: Optional[str] = None, passcode: Optional[str] = None, heart_beat: Optional[Tuple[int, int]] = (0, 0)) -> None`: Connects to the STOMP server with the provided options.
- `disconnect(receipt_id: Optional[str] = None) -> None`: Disconnects from the STOMP server.
- `nack(message_id: str, transaction: Optional[str] = None) -> None`: Sends a NEGATIVE ACKNOWLEDGE command to deny receipt of a message.
- `send(destination: str, content_type: str, body: str, transaction: Optional[str] = None) -> None`: Sends a message to the specified destination.
- `subscribe(id: str, destination: str, ack_mode: str) -> None`: Subscribes to a destination with the specified ACKNOWLEDGE mode.
- `unsubscribe(id: str) -> None`: Unsubscribes from a destination.

For more information about the STOMP protocol, refer to the [STOMP 1.2 Specification](https://stomp.github.io/stomp-specification-1.2.html).

## Areas for Improvement:

- [ ] More comprehensive documentation
- [ ] Improved connection resilience
- [ ] Enhance communication via SSL/TLS

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hugobrilhante/stompypy",
    "name": "stompypy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.12,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Hugo Brilhante",
    "author_email": "hugobrilhante@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1e/13/fa77cc101c6343f52bdab6997d341721464873bcd59ba34e79cfd9d335e2/stompypy-0.4.0.tar.gz",
    "platform": null,
    "description": "# StompyPy <img src=\"https://github.com/hugobrilhante/stomppy/blob/main/docs/images/stompypy.png\" width=35 height=35 />\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=alert_status)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=security_rating)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=bugs)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=code_smells)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=ncloc)](https://sonarcloud.io/dashboard?id=hugobrilhante_stompypy)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=hugobrilhante_stompypy&metric=coverage)](https://sonarcloud.io/summary/new_code?id=hugobrilhante_stompypy)\n[![PyPI version](https://badge.fury.io/py/stompypy.svg)](https://badge.fury.io/py/stompypy)\n[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/https://github.com/hugobrilhante/stompypy/blob/main/LICENSE)\n[![Downloads](https://static.pepy.tech/badge/stompypy)](https://pepy.tech/project/stompypy)\n\nThe stompypy is a simple implementation of the STOMP (Simple Text Oriented Messaging Protocol) protocol. It provides an easy way to connect to and exchange STOMP frames with a STOMP server.\n\n## Installation\n\nTo install the stompypy package, you can use pip:\n\n```shell\npip install stompypy\n```\n\n## Usage Example \ud83d\ude80\n\nHere's an example demonstrating how to use the `Stomp` class to interact with a STOMP server:\n\n```python\nimport time\n\nfrom stompypy import Listener\nfrom stompypy import Stomp\n\n\nclass MyListener(Listener):\n    def on_disconnect(self):\n        print('Disconnected')\n\n    def on_connect(self):\n        print('Connected')\n\n    def on_message(self, frame) -> None:\n        print('Message:', frame.body)\n\n\nif __name__ == '__main__':\n    # Create a STOMP connection to the server\n    connection = Stomp.create_connection(host='localhost', port=61613)\n\n    # Add listener\n    connection.add_listener(MyListener())\n\n    # Connect to the STOMP server\n    connection.connect()\n\n    # Subscribe to a destination\n    connection.subscribe(id='1', destination='/queue/example', ack_mode='auto')\n\n    # Send a message to the destination\n    connection.send(destination='/queue/example', content_type='text/plain', body=f'Hello World!')\n\n    time.sleep(1)\n\n    # Disconnect from the server\n    connection.disconnect()\n```\n\n## Methods of the Stomp Class \ud83d\udee0\ufe0f\n\n- `ack(message_id: str, transaction: Optional[str] = None) -> None`: Sends an ACKNOWLEDGE command to confirm receipt of a message.\n- `abort(transaction: str) -> None`: Sends an ABORT command to roll back a transaction.\n- `begin(transaction: str) -> None`: Sends a BEGIN command to start a transaction.\n- `commit(transaction: str) -> None`: Sends a COMMIT command to confirm a transaction.\n- `connect(host: Optional[str] = '/', accept_version: str = '1.2', login: Optional[str] = None, passcode: Optional[str] = None, heart_beat: Optional[Tuple[int, int]] = (0, 0)) -> None`: Connects to the STOMP server with the provided options.\n- `disconnect(receipt_id: Optional[str] = None) -> None`: Disconnects from the STOMP server.\n- `nack(message_id: str, transaction: Optional[str] = None) -> None`: Sends a NEGATIVE ACKNOWLEDGE command to deny receipt of a message.\n- `send(destination: str, content_type: str, body: str, transaction: Optional[str] = None) -> None`: Sends a message to the specified destination.\n- `subscribe(id: str, destination: str, ack_mode: str) -> None`: Subscribes to a destination with the specified ACKNOWLEDGE mode.\n- `unsubscribe(id: str) -> None`: Unsubscribes from a destination.\n\nFor more information about the STOMP protocol, refer to the [STOMP 1.2 Specification](https://stomp.github.io/stomp-specification-1.2.html).\n\n## Areas for Improvement:\n\n- [ ] More comprehensive documentation\n- [ ] Improved connection resilience\n- [ ] Enhance communication via SSL/TLS\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The StompyPy is a simple implementation of the STOMP (Simple Text Oriented Messaging Protocol) protocol. It provides an easy way to connect to and exchange STOMP frames with a STOMP server.",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/hugobrilhante/stompypy",
        "Repository": "https://github.com/hugobrilhante/stompypy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6fc618d109c90978b1eb170b9c6fac539c00224e1441674d1664c879ce1041f",
                "md5": "be6abd0f2ec5157e861eb3d2a08aec3c",
                "sha256": "cb4134d5f27108048d1964b9b8a9894e6d538ea5bf4744ea7967062c1c59fe2f"
            },
            "downloads": -1,
            "filename": "stompypy-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "be6abd0f2ec5157e861eb3d2a08aec3c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12,<4.0",
            "size": 12420,
            "upload_time": "2024-03-04T17:43:18",
            "upload_time_iso_8601": "2024-03-04T17:43:18.138818Z",
            "url": "https://files.pythonhosted.org/packages/c6/fc/618d109c90978b1eb170b9c6fac539c00224e1441674d1664c879ce1041f/stompypy-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1e13fa77cc101c6343f52bdab6997d341721464873bcd59ba34e79cfd9d335e2",
                "md5": "c2ce00734cffa610ee557169c683cacd",
                "sha256": "cfd182b0650c59724e5058be3d1e0058c2f9453a7311c650f6fe197552d9e65a"
            },
            "downloads": -1,
            "filename": "stompypy-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c2ce00734cffa610ee557169c683cacd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12,<4.0",
            "size": 10419,
            "upload_time": "2024-03-04T17:43:19",
            "upload_time_iso_8601": "2024-03-04T17:43:19.418907Z",
            "url": "https://files.pythonhosted.org/packages/1e/13/fa77cc101c6343f52bdab6997d341721464873bcd59ba34e79cfd9d335e2/stompypy-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-04 17:43:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hugobrilhante",
    "github_project": "stompypy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "stompypy"
}
        
Elapsed time: 0.42430s