Moved to https://github.com/eu-nebulous; NebulOuS exn's python connector.
Go to file
Fotis Paraskevopoulos 2144911594 Aligned python and java, dynamic consumers for python
Change-Id: I2b63a46431adc4adcb0a4fcbf12012f0077c3414
2024-01-13 19:28:08 +02:00
example Aligned python and java, dynamic consumers for python 2024-01-13 19:28:08 +02:00
exn Aligned python and java, dynamic consumers for python 2024-01-13 19:28:08 +02:00
zuul.d Add basic repo template 2023-12-04 10:45:15 +01:00
.gitignore Initial commit 2023-12-14 23:22:00 +02:00
.gitreview Added .gitreview 2023-10-12 14:31:20 +00:00
.yamllint Add basic repo template 2023-12-04 10:45:15 +01:00
LICENSE Add basic repo template 2023-12-04 10:45:15 +01:00
noxfile.py Add basic repo template 2023-12-04 10:45:15 +01:00
Readme.md Initial commit 2023-12-14 23:22:00 +02:00
requirements.txt Initial commit 2023-12-14 23:22:00 +02:00

Of course, let's integrate everything into a cohesive guide.


Using the exn Module: A Comprehensive Guide

The exn module serves as a connector, enabling communication between various components in a messaging infrastructure. This guide will take you through the basics to advanced usage of the module.

Overview

  • Core Components:
    • Bootstrap: A foundational class setting up the readiness state.
    • CoreHandler: Manages connection start, message reception, and timed tasks.
    • EXN: Main connector class initializing connections and configurations.

Basic Usage

  1. Initialize the EXN class:

    connector = connector.EXN('ui', bootstrap=Bootstrap())
    
  2. Run the connector to start:

    connector.start()
    

Advanced Usage

1. Enabling Health and State Monitoring

The EXN class offers two flags: enable_health and enable_state.

  • enable_health: Enables a scheduled publisher that sends a health-check ping at regular intervals.
  • enable_state: Activates the StatePublisher to manage and signal the lifecycle states of the component.

Gradual Implementation:

a. Basic Setup (No Flags):

```python
connector = connector.EXN('ui', bootstrap=Bootstrap())
```

b. Health Monitoring:

```python
connector = connector.EXN('ui', bootstrap=Bootstrap(), enable_health=True)
```

c. Lifecycle State Monitoring:

```python
connector = connector.EXN('ui', bootstrap=Bootstrap(), enable_health=True, enable_state=True)
```

2. The ready Function

The ready function in your Bootstrap class is called when the component is initialized. Use it to perform specific operations at startup:

Example:

def ready(self, context):
    if context.has_publisher('state'):
        context.publishers['state'].starting()

3. The Importance of the 'key' Argument

Each publisher is identified using a unique 'key', which is crucial when handling multiple publishers:

Example:

context.publishers['state'].starting()

Here, 'state' is the 'key' for a specific publisher, directing it to send a 'starting' signal.

Working with Context

The Context class in the core section aids in managing publishers and consumers within the application. Here's how:

  • Register a publisher:

    context.register_publisher(publisher)
    
  • Check if a publisher exists:

    context.has_publisher('key')
    
  • Build an address from a link:

    context.build_address_from_link(link)
    

Conclusion

The exn module provides a robust platform for component communication, health and lifecycle management, and more. Whether you're looking for simple connectivity or advanced message routing with multiple publishers, this module has got you covered.


This documentation offers an inclusive overview and guide for the exn module. Tailor it as per your specific project requirements or as the module evolves.