Hi guys,
Should I create 2 NSB endpoints - one for processing commands/messages and second for processing events?
public class FunctionHandlerEndpoint
{
readonly FunctionEndpoint _endpoint;
public FunctionHandlerEndpoint(FunctionEndpoint endpoint)
{
_endpoint = endpoint;
}
[FunctionName("CommandHandlers")]
public async Task ProcessCommandsAndMessages(
[ServiceBusTrigger(
queueName: EndpointNames.Notifications,
Connection = GenericStartup.ConnectionStringsServiceBus)]
Message message,
ILogger logger,
ExecutionContext executionContext)
{
await _endpoint.Process(message, executionContext, logger);
}
[FunctionName("EventHandlers")]
public async Task ProcessEvents(
[ServiceBusTrigger(
topicName: "bundle-1",
subscriptionName: EndpointNames.Notifications,
Connection = GenericStartup.ConnectionStringsServiceBus)]
Message message,
ILogger logger,
ExecutionContext executionContext)
{
await _endpoint.Process(message, executionContext, logger);
}
}
I have noticed that this code is throwing exceptions for Cannot create a message e receiver on an entity with auto-forwarding enabled
for ProcessEvents…
So… is the event handling needed as messages are being forwarded into queues ?