Redis Protocol not accepting LPUS, HSET commands - redis

I am trying to do a mass insertion into redis using Redis Protocol format. But it is not accepting commands for LPUSH and HSET. Does Redis Protocol allow complex datatypes for Mass Insertion? *3
$4
LPUSH
$5
Fruit
$5
Apple

Related

Redis detect when a key's value is changed

Without using keyspace notifications, pub/sub and streams, is there a way to detect/listen to a key's value being changed (or a key being added to a hashmap) in Redis?
Thanks

Redis stream that should be consumed by all clients

I am new to Redis. I have a use case that a Redis stream shall be consumed by every member of a group of clients. However, currently the concept of consumer group in Redis stream means a message shall be consumed only once by any of the client in the group.
Does Redis stream has built in support for this particular use case?
Thank you
---Patrick

Can redis key space notifications be pushed to the redis stream instead of pub/sub channel

We have a requirement that we need to get a notification on changes to a Redis data structure. Based on my research I found out that I can use Redis key space notifications for doing the same. However, Redis key space notifications send the events to Redis pub/sub channel which is fire and forget i.e once the clients lose the connections all the events till the connection is up again are lost.
Redis streams solve this problem. Also I want to use consumer group feature of Redis streams. So is there any way that Redis key space notifications can be pushed to Redis streams instead of Redis pub/sub channel?
The only way this can be done afaik with the current - Redis v5.0.3 - is to use the Modules API to develop a module that registers for keyspace notifications, processes them and adds the relevant messages into the Stream.
With RedisGears it's pretty simple to register a listener that will automatically write each event to a Stream.
e.g. the following register.py script will write for each HSET or HMSET call on person:* key prefix an event to mystream Stream.
register.py:
GearsBuilder() \
.foreach(lambda x: execute('XADD', "mystream", '*', *sum([[k,v] for k,v in x.items()],[]))) \
.register(prefix="person:*", eventTypes=['HSET', 'HMSET'])
To run it all you need to do is call:
$ gears-cli run register.py

what is the difference between seneca redis pubsub transport and seneca redis queue transport?

I'm learning on how to get data from redis using seneca js but seneca provides multiple plugins to connect to redis. and available plugins are the ones mentioned in the title. which should I use just to fetch a couple of keys from redis? and what is the difference between the two?
seneca-redis-pubsub-transport and seneca-redis-queue-transport are both used for transporting messages between services using redis.
seneca-redis-pubsub-transport is a broadcast transport. All subscribed services will receive all messages. seneca-redis-queue-transport on the other hand is a queue transport. Messages are sent to only one of possibly multiple subscribed services.
If you only want to get/set some values that take a look at seneca-redis-store. This plugin allows you to get and set values using redis.

Redis lindex works but not lpop

I'm seeing this strange behavior. I do a lpush to a key. There is a different service that listens to key notifications and tries to lpop the value. But strangely it returns null. If I do a lindex with 0 as index, I get the value. So, I know for sure the value is available. I can see that using redis-cli. But lpop does not return the value.
I use redis 2.8.13 and Jedis Java framework. Can someone please help?
To debug this try to use redis MONITOR command (for example by running redis-cli monitor in a shell on the redis host) to see:
what commands are really being sent to your redis,
when
and by which client.
It is a long shot without seeing the code but I think that your code using Jedis is not sending exactly the commands you think it is sending.