Questions tagged [idempotent]

A function is said to be idempotent when it can be called multiple times without changing the result.

Idempotence is a property of certain function in mathematics or computer science. It states that the function can be applied multiple times without changing the result from the result of applying the function a single time.

Examples from mathematics

  • Multiplying some value by 1, or by 0; these should give the same result no matter how many times they are applied. I.e.:

    (x * 1) == (1 * (1 * x)) == (1 * (1 * (1 * x))) == ...

  • abs(x):

    abs(-3) == 3, but abs(3) == 3 too. Similarly abs(abs(-3)) == abs(abs(abs(-3))) ...

Examples from computer sience

  • HTTP-context: A GET-operation or a DELETE-operation; each of these should effect the same results each time. A counter-example could be a post-operation, which may result in a different outcome / state each time it is called (calling it multiple times may result in duplicate date being stored, for instance).
  • Setting a (boolean) flag; the resulting state should be the same whether you set it once or many times.
272 questions
2
votes
3 answers

What is use of the idempotent producer in kafka?

Even if you use the idempotent producer, you still need to do the idempotent work in consumer , so what is the use of the idempotent producer in kafka? just to reduce the duplication in broker, saving the storage ?
2
votes
0 answers

Implementing Idempotency-key for a POST method in Springboot

I want to implement idempotency-key for POST method in springboot. eg: http://localhost:8020/project/createStudent Above is my POST method invocation. I will pass student details in body along with idempotency-key in header. What I want to achieve…
2
votes
1 answer

Amazon EventBridge/Step Function/Lambda - Possible to achieve idempotency without introducing synchronous processing?

We have a Workflow (Step Function) that is triggered via an EventBridge rule and inside that Workflow is a lambda that creates a record in a third party vendor system. Assuming the third party vendor API does not have a way to enforce uniqueness of…
2
votes
1 answer

Hibernate Idempotent Update

I tried searching this over the net but in vain. Is there a way to use hibernate to perform an idempotent update. One use case is to use HTTP PUT to update a specific field in the database via a REST API. So for example, if I have a database with…
Raghav
  • 33
  • 6
2
votes
1 answer

How to implement idempotency in NestJS via idempotency key?

I've learned that idempotent requests must return the same response given that the same request sent. But not really sure how to implement this in Nestjs Architecture ? If resource has been already created and duplicate request was recognized, then…
Denys Rybkin
  • 637
  • 1
  • 6
  • 18
2
votes
1 answer

Kafka Mirromaker2 producer idempotence and duplicates

I have setup a mirrormaker2 on 2 clusters (CL1,CL2) and the mirroring seems to work properly except with an issue with duplicates in a test topic in the following scenario: While both clusters are up and running i simulate an incident, stopping one…
2
votes
1 answer

Kafka-python producer enable.idempotent

i'm facing the duplication data in kafka so i want to use idempotent in kafka-python but unfortunately its not the part of it, how i can stop the duplication data in same partition with out idempotent or there is any way to import it or customize…
2
votes
1 answer

Camel File component - whats the difference between a IdempotentRepository and a InProgressRepository

What's exactly the difference between the IdempotentRepository and the InProgressRepository? I have following definitions from the File component page: IdempotentRepository: "Option to use the Idempotent Consumer EIP pattern to let Camel skip…
bramdc
  • 580
  • 1
  • 5
  • 21
2
votes
1 answer

Why memcached set operation is not idempotent?

On the page 2 of the Facebook's paper "Scaling Memcache at Facebook" they said "For write requests,the webserver issues SQL statements to the database and then sends a delete request to memcache that invalidates any stale data. We choose to delete…
user485553
  • 161
  • 2
  • 14
2
votes
1 answer

AWS SQS FIFO queue still requires consumers to be idempotent?

Some time ago AWS introduced SQS FIFO queue, which guarantees message ordering and exactly one processing. My question is about the second assumption, shouldn't it be changed to exactly one delivery? Because even if only one copy of a message can be…
revy
  • 3,945
  • 7
  • 40
  • 85
2
votes
1 answer

How to make Oracle ALTER TABLE MODIFY script be idempotent?

I have this migration script; ALTER TABLE table_name MODIFY (column_name NULL); How do I make it idempotent?
alpanT
  • 23
  • 3
2
votes
3 answers

Idempotent decryption routine/algorithm

Is there a simple decryption algorithm that is idempotent? Something like this: decrypt(encrypt(x)) === x === decrypt(decrypt(decrypt(encrypt(x))))
user7898461
2
votes
1 answer

Firebase cloud function idempotency in docs

I'm following the docs for Firestore here on Aggregation Queries. I couldn't help but notice that the cloud function solution wouldn't exactly work since it's not idempotent: numRatings is incremented and avgRating recomputed each time. Though this…
2
votes
1 answer

What is idempotency in HTTP PUT? Can I disallow overwriting of a resource?

I'm writing a REST API and I wish to allow authenticated users with the proper permissions to upload files via this API. I thought I'd use a PUT endpoint to handle this. I want to include a failsafe where the request will be rejected with a…
p0lar_bear
  • 2,203
  • 2
  • 21
  • 31
2
votes
1 answer

Camel Idempotent Consumer incorrect behaviour for removeOnFailure=true

I would like to know if the below is expected behaviour for Camel idempotent consumer: I have removeOnFailure=true for the route, which means basically when the exchange fails idempotent consumer should remove the Identifier from the repository.…
Shoaib Khan
  • 899
  • 14
  • 26