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
|
|
|
|
/// <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
|
|
|
|
|
2021-05-29 19:51:58 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
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 />
|
2022-11-23 08:13:38 +00:00
|
|
|
|
public async Task<TResponse> RequestResponse<TRequest, TResponse>(TRequest request) where TRequest : class where TResponse : class
|
2019-04-24 16:04:30 +00:00
|
|
|
|
{
|
2024-04-08 12:20:15 +00:00
|
|
|
|
return (TResponse)await router.RequestResponse(publisher, request).ConfigureAwait(false);
|
2019-04-24 16:04:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|