Skip to content

Event Hub binding should allow transforming ALL custom properties as headers, not just iot-hub systemproperties #3570

Closed
@oising

Description

Describe the feature

Currently only a fixed set of system properties from Azure IoT Hub are forwarded as headers when delivered to a subscriber. The Azure Event Hubs binding should expose a getAllProperties property (false by default) to forward all user/app/custom properties from the Event Hub message as headers to the subscriber.

It seems that is 90% supported already in the DAPR codebase, but it stops short at exposing the setting in the manifest. i.e.

// GetBindingsHandlerFunc returns the handler function for bindings messages
func (aeh *AzureEventHubs) GetBindingsHandlerFunc(topic string, getAllProperties bool, handler bindings.Handler) HandlerFn {
	return func(ctx context.Context, messages []*azeventhubs.ReceivedEventData) ([]HandlerResponseItem, error) {
		if len(messages) != 1 {
			return nil, fmt.Errorf("expected 1 message, got %d", len(messages))
		}

		bindingsMsg, err := NewBindingsReadResponseFromEventData(messages[0], topic, getAllProperties)
		if err != nil {
			return nil, fmt.Errorf("failed to get bindings read response from azure eventhubs message: %w", err)
		}

		aeh.logger.Debugf("Calling app's handler for message %s on topic %s", messages[0].SequenceNumber, topic)
		_, err = handler(ctx, bindingsMsg)
		return nil, err
	}
}

Release Note

RELEASE NOTE:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions