How to use akka as a replication mechanism

I am new to akka and intend to use it in my new project as a mechanism for data replication.

In this case, there is a master server and a replicated data server. Replicative data must contain the same data as the master. Each time a data change occurs in the wizard, it sends an update message to the replication server. Here, the main server is the sender, and the Replicate server is the receiver.

But after digging through the documents, I'm still not sure how to satisfy the following use cases:

  • When the receiver fails, the sender must accumulate messages for sending, not a single message should be lost. It should reconnect to the receiver and continue with the last successful message.
  • when the sender crashes, it must reboot and no messages between restarts will be lost.
  • Messages are processed with the same order that they sent.

So my question is: how to configure akka to create a sender and a recipient that could do this?

I'm not sure if an actor with DurableMessageBox can solve this problem. If it were possible, how can I simulate the situations described above for testing?

Update:

After reading the documents Victor pointed out, I now realized that I needed the template once and once , which is very expensive.

The akka docs say:

Actual transports may provide stronger semantics, but at most once , this is the semantics you should expect. Alternatives will be once and once , which is extremely expensive, or at least once , which essentially requires idempotency of message processing, level problems.

Therefore, in order to achieve guaranteed delivery, I may need to turn to another MQ solution (for example, Kafka ) or try to Submit once and once using DurableMessageBox and see if it can get rid of the complexity with my specific use case.

+4
source share
1 answer

You will need to write your own remote access that uses a solid subscriber template, because the guarantees for sending Akka messages are less stringent than what you are going to do: http://doc.akka.io/docs/akka/2.0/general/message- send-semantics.html

Cheers, √

+2
source

Source: https://habr.com/ru/post/1402163/


All Articles