I using Redis in my producer and consumer in two different service but consumer not handle event
AmrElshaer opened this issue · 1 comments
-- consumer configuration
` builder.Services.AddCap(capOptions =>
{
capOptions.UseSqlServer(options =>
{
options.ConnectionString = connectionString;
options.Schema = "outbox";
});
var useMemoryCache = builder.Configuration.GetSection("Redis:UseMemoryCache").Get<bool>();
if (useMemoryCache)
{
capOptions.UseInMemoryMessageQueue();
}
else
{
var redisConnection = builder.Configuration["Redis:ConnectionString"] ??
throw new InvalidOperationException("Redis connection string is null or empty.");
capOptions.UseRedis(redisConnection);
capOptions.DefaultGroupName = "cap.queue.talabeyah.api.command.v1";
}
});`
---- producer configuration
` services.AddCap(capOptions =>
{
capOptions.UseSqlServer(options =>
{
options.ConnectionString = sqlConnection;
options.Schema = "outbox";
});
var useMemoryCache = _configuration.GetSection("Redis:UseMemoryCache").Get();
if (useMemoryCache)
{
capOptions.UseInMemoryMessageQueue();
}
else
{
var redisConnection = _configuration["Redis:ConnectionString"] ??
throw new InvalidOperationException("Redis connection string is null or empty.");
capOptions.UseRedis(redisConnection);
}
var isDashboardEnabled = _configuration.GetValue<bool>("CAP:IsDashboardEnabled");
if (isDashboardEnabled)
{
capOptions.UseDashboard(dashboardOptions =>
{
dashboardOptions.PathMatch = "/cap";
});
}
});`
publish event added in redis good, but consumer not work no data in receive table, but publish event in table publish
`[PublicAPI]
public class CustomerCreditAmountUpdatedEventHandler : ICapSubscribe
{
private readonly ICache _cache;
public CustomerCreditAmountUpdatedEventHandler(ICache cache) => _cache = cache;
[CapSubscribe(PlatformConstants.Events.Customers.CustomerCreditAmountUpdated)]
public async Task HandleAsync(CustomerCreditAmountUpdatedIntegrationEvent updatedIntegrationEvent)
{
var customerKey = CacheKeys.GetCreditCustomerTotalRemainingAmountKey(updatedIntegrationEvent.CustomerId);
await _cache.RemoveAsync(customerKey);
}
}`
Is CustomerCreditAmountUpdatedEventHandler
registered to the container?