2019-08-13 20:30:04 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2019-04-24 18:04:30 +02:00
|
|
|
|
|
|
|
|
|
namespace Tapeti.Transient
|
|
|
|
|
{
|
2019-08-13 20:30:04 +02:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default implementation of ITransientPublisher
|
|
|
|
|
/// </summary>
|
2019-08-15 11:26:55 +02:00
|
|
|
|
internal class TransientPublisher : ITransientPublisher
|
2019-04-24 18:04:30 +02:00
|
|
|
|
{
|
|
|
|
|
private readonly TransientRouter router;
|
2019-04-25 15:19:51 +02:00
|
|
|
|
private readonly IPublisher publisher;
|
2019-04-24 18:04:30 +02:00
|
|
|
|
|
2019-08-13 20:30:04 +02:00
|
|
|
|
|
2021-05-29 21:51:58 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
2019-04-25 15:19:51 +02:00
|
|
|
|
public TransientPublisher(TransientRouter router, IPublisher publisher)
|
2019-04-24 18:04:30 +02:00
|
|
|
|
{
|
|
|
|
|
this.router = router;
|
2019-04-25 15:19:51 +02:00
|
|
|
|
this.publisher = publisher;
|
2019-04-24 18:04:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-13 20:30:04 +02:00
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2019-04-24 18:04:30 +02:00
|
|
|
|
public async Task<TResponse> RequestResponse<TRequest, TResponse>(TRequest request)
|
|
|
|
|
{
|
2019-08-15 16:00:04 +02:00
|
|
|
|
return (TResponse)await router.RequestResponse(publisher, request);
|
2019-04-24 18:04:30 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|