Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure EventHub hook support #625

Merged
merged 1 commit into from
Oct 22, 2021
Merged

Conversation

lokisisland
Copy link

As discussed on Slack recently, we have added EventHub hook support. We have tested this running the code in this branch with real data and the messages are being written successfully to the event hub.

@tidwall
Copy link
Owner

tidwall commented Oct 21, 2021

Hi,

Thanks for the PR.

While Looking at the docs for this feature:

https://github.com/tile38/tile38.github.io/pull/51/files#diff-9f58aacff06286b39e375539999a852b7227957dd1dc45801cc7d25d2d6fdd11R244

I see that URL for the endpoint looks a little different that a standard URL.

Endpoint=sb://event-hub-namespace.windows.net/;SharedAccessKeyName=sharedAccessKeyName;SharedAccessKey=***Secret***;EntityPath=event-hub-name

I was expecting something like:

eventhub://event-hub-namespace.windows.net?SharedAccessKeyName=sharedAccessKeyName&SharedAccessKey=***Secret***&EntityPath=event-hub-name

Is this due to an EventHub requirement on Azures side?

@lokisisland
Copy link
Author

Hey,

Yes, the whole argument is a connection string rather than a URI; the connection string does contain the URI but there are other elements required as well. The connection string is comprised of the Endpoint (URI), SharedAccessKeyName (name of the access key to follow), SharedAccessKey (the access key) and EntityPath (Azure parlance for what is, in effect, the queue name). The connection string uses semi-colons to delimit each section, and each section is of the form SectionName=SectionValue. If we removed the "Endpoint=" at the beginning, we'd have to add it again to make the connection string valid.

Full details of an EventHub connection string can be found at: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-get-connection-string.

We thought it best to allow users to provide the full connection string (rather than specifying fields separately via query args like are currently implemented for Kafka connections) as the connection string in full is provided in the Azure UI. To provide the fields separately would require the user to break down the connection string just for the software to recombine it, thus increasing the likelihood of error.

I hope this makes sense! Let me know if not :)

Copy link
Owner

@tidwall tidwall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the URI connection string starting with "Endpoint=" makes sense.
Though I wonder if though if we shouldn't allow both "Endpoint=sb://..." and "sb://..." interchangeably?

internal/endpoint/endpoint.go Show resolved Hide resolved
@tidwall tidwall merged commit 8961cf5 into tidwall:master Oct 22, 2021
@tidwall
Copy link
Owner

tidwall commented Oct 22, 2021

lgtm :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants