skip to Main Content

How to avoid duplicate notifications when subscribing multiple times to the same Redis channel?

I have an issue where, if I subscribe multiple times to the same Redis channel, my subscribers start receiving duplicate messages. Here is my subscription method: public void SubscribeToUserNotifications(string userId, Action<string?> onMessage) { _subscriber.Subscribe ( new RedisChannel($"orders:notifications:user:{userId}", RedisChannel.PatternMode.Literal), (channel, message)…

VIEW QUESTION

Spring-Boot 2.7 Redis PUB/SUB fails startup on missing Redis connection

I have this configuration for my pub/sub implementation: @Bean public RedisMessageListenerContainer container(LettuceConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapter) { RedisMessageListenerContainer container = new RedisMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.addMessageListener(listenerAdapter, new ChannelTopic(publishChannel)); return container; } @Bean public MessageListenerAdapter listenerAdapter(RedisReceiver receiver) { return new MessageListenerAdapter(receiver, "receiveMessage"); } @Bean…

VIEW QUESTION

Quarkus SSE Redis subscribe

I like to do an SSE with the response of redis.subscribe in quarkus. I have a sample from the quarkus-quickstart for a simple SSE @GET @Produces(MediaType.SERVER_SENT_EVENTS) @SseElementType(MediaType.TEXT_PLAIN) @Path("{name}/streaming") public Multi<String> greeting(@org.jboss.resteasy.annotations.jaxrs.PathParam String name) { return Multi.createFrom().publisher(vertx.periodicStream(2000).toMulti()) .map(l -> String.format("Hello %s!…

VIEW QUESTION
Back To Top
Search