Skip to main content

StompyPy

Quality Gate Status Maintainability Rating Reliability Rating Security Rating Bugs Code Smells Vulnerabilities Lines of Code Coverage PyPI version GitHub Downloads

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:

pip install stompypy

Usage Example 🚀

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

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.

Areas for Improvement:

  • More comprehensive documentation
  • Improved connection resilience
  • Enhance communication via SSL/TLS

Release files for stompypy 0.4.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 stompypy 0.4.0
File Size Uploaded
stompypy-0.4.0.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stompypy 0.4.0
File Interpreter ABI Platform
stompypy-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.8 kB

Release files / stompypy-0.4.0.tar.gz

Download URL stompypy-0.4.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cfd182b0650c59724e5058be3d1e0058c2f9453a7311c650f6fe197552d9e65a
BLAKE2b-256 checksum
How to use checksums
1e13fa77cc101c6343f52bdab6997d341721464873bcd59ba34e79cfd9d335e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.1 CPython/3.12.2 Darwin/23.3.0

Release files / stompypy-0.4.0-py3-none-any.whl

Download URL stompypy-0.4.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb4134d5f27108048d1964b9b8a9894e6d538ea5bf4744ea7967062c1c59fe2f
BLAKE2b-256 checksum
How to use checksums
c6fc618d109c90978b1eb170b9c6fac539c00224e1441674d1664c879ce1041f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.1 CPython/3.12.2 Darwin/23.3.0

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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