Giter Site home page Giter Site logo

azure-event-hubs-python's Introduction

The eventhubs Python client provides,

  • a sender to publish events to the Event Hubs service.
  • a receiver to read events from the Event Hubs service. On Python 3.5 and above, it also includes,
  • async sender and receiver that supports async/await methods.
  • an event processor host module that manages the distribution of partition readers.

Build and Install

Local

The core library requires Apache Proton-C and its Python binding.

For eventprocessorhost, you will also need (list for Fedora 26, adjust for other distributions),

  • libs: libxml2-devel, libxslt-devel, libffi-devel, python3-cffi, redhat-rpm-config
  • Python packages: requests, bs4, lxml, azure-storage, azure-storage-blob

On Windows a private patch to proton-c code is required for the library to work.

Docker

The following Dockerfile at ./examples/Dockerfile creates a Docker image with Apache Proton and the Azure Event Hubs SDK.

The base image is Python 3.6-slim-stretch and Proton 0.18.1 but you can set the PYTHON_IMAGE_VERSION PROTON_VERSION PYTHON_DIR_VERSION when building the image.

docker build -t azure-eventhubs-sdk --build-arg PYTHON_IMAGE_VERSION=3.6-slim-stretch --build-arg PROTON_VERSION=0.18.1 --build-arg PYTHON_DIR_VERSION=3.6 .

After the image is built you can run the samples with

docker run -it azure-eventhubs-sdk python examples/send.py
Note that you have fill the Event Hub connection parameters in the example py files.

Examples

  • ./examples/send.py - use sender to publish events

  • ./examples/recv.py - use receiver to read events

  • ./examples/send_async.py - async/await support of a sender

  • ./examples/recv_async.py - async/await support of a receiver

  • ./examples/eph.py - event processor host

  • ./examples/Dockerfile - create a Docker image with Apache Proton and Azure Event Hubs SDK

  • ./tests/send.py - how to perform parallel send operations to achieve high throughput

  • ./tests/recv.py - how to write an event pump to read events from multiple partitions

Logging

  • enable 'eventhubs' logger to collect traces from the library
  • enable AMQP frame level trace by setting environment variable (export PN_TRACE_FRM=1)

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-event-hubs-python's People

Contributors

xinchen10 avatar aribornstein avatar vjrantal avatar microsoftopensource avatar torosent avatar itamar-otonomo avatar msftgits avatar

Watchers

James Cloos avatar Aksana Kuzmitskaya avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.