Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class RabbitMqTriggerBindingProvider : ITriggerBindingProvider
{
private readonly ILogger _logger;
public RabbitMqTriggerBindingProvider(ILogger logger)
{
_logger = logger;
}
public Task<ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context)
{
var parameter = context.Parameter;
var attribute = parameter.GetCustomAttribute<RabbitMqTriggerAttribute>(false);
if (attribute == null) return Task.FromResult<ITriggerBinding>(null);
if (parameter.ParameterType != typeof(BasicDeliverEventArgs)) throw new InvalidOperationException("Invalid parameter type");
var triggerBinding = new RabbitMqTriggerBinding(parameter, _logger);
return Task.FromResult<ITriggerBinding>(triggerBinding);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.