Replies: 1 comment
-
I managed to get a working example: input:
generate:
mapping: |
root.key = random_int(min:1, max:3)
root.id = uuid_v4()
root.ts = now()
interval: 1ms
count: 1000
batch_size: 100
auto_replay_nacks: false
pipeline:
processors:
- group_by_value:
value: '${! json("key") }'
- cache:
resource: multi_cache
operator: get
key: 'test/${! json("key") }'
- catch:
- catch: []
- try:
- cache:
resource: mem_cache
operator: add
key: 'test/${! json("key") }'
value: '${! json("id") }'
- cache:
resource: s3_cache
operator: set
key: 'test/${! json("key") }'
value: '${! json("id") }' I've tried the following input:
generate:
mapping: |
root.key = random_int(min:1, max:9)
root.id = uuid_v4()
root.ts = now()
interval: 1ms
count: 100000
batch_size: 100
auto_replay_nacks: false
pipeline:
processors:
- group_by_value:
value: '${! json("key") }'
- cache:
resource: multi_cache
operator: get
key: 'test/${! json("key") }'
- catch:
- catch: []
- cache:
resource: multi_cache
operator: add
key: 'test/${! json("key") }'
value: '${! json("id") }' But if failed my test as well, there was at least one instance of overwrite in the cache. Is there a better way to achieve this? Maybe something more optimized, I feel weird to use "catch", "catch:[]" and "try" in sequence |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I've been interested in the cache S3 for a specific use case and would like to hear some feedback on my approach.
According to https://docs.redpanda.com/redpanda-connect/components/caches/aws_s3/
Trying to emulate a similar outcome using a memory cache in between the input and the S3. I came up with this idea:
What I was expecting:
I understand that it would not be completely atomic because if the job fails in the
set
stage, we would have the key set in memory but not in s3, I expect that this scenario will be extremelly rare and even if happens, it still Ok, as long as no more than one version is written to s3.Use case:
What I am getting:
Question: Is there a point of failure in my reasoning that I haven't thought about? Am I using the processors correctly? Is it possible to achieve 'write once and do not overwrite' writes to S3 using Redpanda connect? Is there a better way to achieve it?
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions