streaming-at-scale icon indicating copy to clipboard operation
streaming-at-scale copied to clipboard

eventhubs-databricks-eventhubs

Open tessmichi opened this issue 5 years ago • 4 comments

tessmichi avatar Jun 26 '19 18:06 tessmichi

How should I write the data back to eventhubs? When I read it in from the input eventhubs it's in binary format, so should i write it back to the output eventhubs in binary format as well? Tagging @jcocchi or please let me know who else I should tag too!

tessmichi avatar Jul 08 '19 18:07 tessmichi

Data in EventHub is in binary format, but you should sent to it just in plain text (if you're sending JSON). It will stored in the binary format automatically.

yorek avatar Jul 08 '19 23:07 yorek

You need to put the body in a column called 'body'

https://github.com/Azure/azure-event-hubs-spark/blob/master/docs/structured-streaming-eventhubs-integration.md#creating-an-eventhubs-sink-for-streaming-queries

To generate JSON from a struct: https://spark.apache.org/docs/latest/api/java/org/apache/spark/sql/functions.html#to_json-org.apache.spark.sql.Column-

algattik avatar Jul 10 '19 11:07 algattik

I have an example of reading from Event Hub and then writing back to an Event Hub using Structured Streaming here: https://github.com/mpfishe2/az-databricks-realtime-alert-system/blob/master/Real-Time%20Alerting.ipynb. Its a simple example.

mpfishe2 avatar Jul 23 '19 18:07 mpfishe2