1
0
mirror of synced 2024-11-14 22:33:50 +00:00
Tapeti/Tapeti.Transient/TransientGenericBinding.cs
Menno van Lavieren 6bc6cfe216 MAX-911 RDB Relaties samenvoegen vanuit LEF en update ontvangen in LEF
MAX-1081 POC Dictionary tasks in Web voor request
Setup voor Transient request response met TODO's
2019-04-24 18:04:30 +02:00

52 lines
1.3 KiB
C#

using System;
using System.Reflection;
using System.Threading.Tasks;
using Tapeti.Config;
namespace Tapeti.Transient
{
public class TransientGenericBinding : ICustomBinding
{
private readonly TransientRouter router;
public TransientGenericBinding(TransientRouter router, string dynamicQueuePrefix)
{
this.router = router;
DynamicQueuePrefix = dynamicQueuePrefix;
Method = typeof(TransientRouter).GetMethod("GenericHandleResponse");
}
public Type Controller => typeof(TransientRouter);
public MethodInfo Method { get; }
public QueueBindingMode QueueBindingMode => QueueBindingMode.DirectToQueue;
public string StaticQueueName => null;
public string DynamicQueuePrefix { get; }
public Type MessageClass => null;
public bool Accept(Type messageClass)
{
return true;
}
public bool Accept(IMessageContext context, object message)
{
return true;
}
public Task Invoke(IMessageContext context, object message)
{
router.GenericHandleResponse(message, context);
return Task.CompletedTask;
}
public void SetQueueName(string queueName)
{
router.TransientResponseQueueName = queueName;
}
}
}