Skip to main content

Event SDK for creating Events in the helix architecture

Project description

helix.events.sdk

The helix.events.sdk package facilitates sending strongly typed events within the helix architecure. Currently one type of event, AuditEvent, is supported.

How to set up

  • make devsetup - to build the dev setup
  • make tests - to run all tests under /tests/ directory

Examples

  • The following code snippet shows how to instantiate and send and audit event:
# create the AuditEvent
event = AuditEvent(Source.BWELLBACKEND, Audit(patient_id="1",
                                              user_id="1",
                                              user_role="Patient",
                                              ip_address="192.168.1.1",
                                              action=AuditAction.READ,
                                              action_type=AuditActionType.VIEW,
                                              accessed_resource=ResourceType.DIAGNOSES))

kafka_brokers = [
    "kafkabroker1:9092",
    "kafkabroker1:9092"
]
with KafkaEventWriter(
    get_logger(), kafka_brokers=kafka_brokers, use_ssl=True
) as kafka_event_writer:
    kafka_event_writer.write_event(event=event)

The above code shows how to write an event to Kafka assuming the kafka cluster has two brokers and uses TLS.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

helix.events.sdk-0.1.1.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

helix.events.sdk-0.1.1-py3-none-any.whl (12.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page