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
|
|
|
|
/// <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 />
|
2022-11-23 09:13:38 +01:00
|
|
|
|
public async Task<TResponse> RequestResponse<TRequest, TResponse>(TRequest request) where TRequest : class where TResponse : class
|
2019-04-24 18:04:30 +02:00
|
|
|
|
{
|
2024-04-08 14:20:15 +02:00
|
|
|
|
return (TResponse)await router.RequestResponse(publisher, request).ConfigureAwait(false);
|
2019-04-24 18:04:30 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|