I require a record to be present in the ignite database all the time. For
this I have written a function like following:

>
> @PostConstruct
> public void createRecordIfNotPresent() {
>     if (entityRepository.findById(1) == null) {
>         createRecord()
>     }
> }


I have added @PostContruct annotation so that this code is run when a node
boots up. This way I make sure that record is present all the time.

But the problem I'm facing with above code is that, the function runs even
before the node which when boots up has joined the Ignite cluster. So,
"entityRepository.findById(1)" returns "null" and this results in split
brain problem.

How can I fix this problem? I'm thinking about using AFTER_NODE_START. My
question is whether this event is released after the node has completed
joining the cluster (if present) or not?

Thank You

Reply via email to