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