Hi

Victor was faster than me, but yes, he is right.

You can set the “fineract.node-id” in the application.properties directly (not 
recommended) or override as environement variable (FINERACT_NODE_ID) 
(recommended).

In the “job” table you can find a column for each job that exists in the 
system: “node_id” this value is matched with the scheduler on the running 
instances and if the running instances node_id is matching that particular 
scheduler will execute the job.

Make sure you are not running multiple instance of Fineract with the same 
“node_id” or that lead to duplicate job execution!

I hope this helps!

Regards,
Adam

> On 2025. Jul 3., at 7:53, VICTOR MANUEL ROMERO RODRIGUEZ 
> <victor.rom...@fintecheando.mx> wrote:
> 
> Bashar,
> 
> The variable can be set in your environment, some samples:
> 
> https://github.com/search?q=repo%3Aapache%2Ffineract%20FINERACT_NODE_ID&type=code
> 
> El mié, 2 jul 2025 a las 23:46, Bhaskar Tiwari (<bhas...@strideone.in 
> <mailto:bhas...@strideone.in>>) escribió:
>> Hi,
>> 
>>  
>> 
>> Any update on this?
>> 
>>  
>> 
>> From: Bhaskar Tiwari 
>> Sent: Monday, June 30, 2025 4:32 PM
>> To: dev@fineract.apache.org <mailto:dev@fineract.apache.org>
>> Subject: RE: Handling Duplicate Entries from Custom Schedulers in Fineract 
>> (Multi-Server Environment)
>> 
>>  
>> 
>> Hi Adam,
>> 
>>  
>> 
>> Sorry for the confusion earlier — to clarify, we are indeed using the Quartz 
>> scheduler as provided by Fineract, with some custom logic added for new 
>> modules. So, we're not using a separate scheduler framework; it's just an 
>> extension of the existing Quartz-based implementation.
>> 
>> Regarding your suggestion on using node_id: 1, could you please guide us on 
>> where exactly we need to configure this? Specifically:
>> 
>>  
>> 
>> Should the node_id be set as a Java system property or as part of a Spring 
>> configuration?
>> 
>>  
>> 
>> Is there any additional setup needed in the “job” table or related 
>> components to ensure only the intended instance runs the schedulers?
>> 
>>  
>> 
>> We want to make sure we implement this correctly to avoid any further issues 
>> in a multi-server environment.
>> 
>>  
>> 
>> Thanks again for your guidance.
>> 
>>  
>> 
>> From: Ádám Sághy <adamsa...@gmail.com <mailto:adamsa...@gmail.com>> 
>> Sent: Monday, June 30, 2025 3:27 PM
>> To: dev@fineract.apache.org <mailto:dev@fineract.apache.org>
>> Subject: Re: Handling Duplicate Entries from Custom Schedulers in Fineract 
>> (Multi-Server Environment)
>> 
>>  
>> 
>> Hi
>> 
>>  
>> 
>> Thank you for the additional details.
>> 
>>  
>> 
>> 1. I am not completely sure why you need “custom” scheduler for this 
>> purpose… quartz should be fine to be used…unless you know something that was 
>> not yet disclosed...
>> 
>> 2. You should not run schedulers on 2 instances… only 1 instance should do 
>> the scheduling, so there wont be conflicts! In Fineract the quartz scheduler 
>> is running on “node_id: 1” and only 1 instance should have this 
>> configuration!
>> 
>>  
>> 
>> I hope this helps!
>> 
>>  
>> 
>> Regards,
>> 
>> Adam
>> 
>>  
>> 
>> On 2025. Jun 30., at 11:45, Bhaskar Tiwari <bhas...@strideone.in 
>> <mailto:bhas...@strideone.in>> wrote:
>> 
>>  
>> 
>> Hi Ádám Sághy
>> 
>>  
>> 
>> Thank you for your response.
>> 
>>  
>> 
>> Please find below the clarification on your queries:
>> 
>>  
>> 
>> What exactly do you mean by “custom scheduler”?
>> We have developed a few custom schedulers to enhance Fineract’s 
>> functionality, specifically for new modules that require generating daily 
>> accruals. These schedulers follow the existing scheduler patterns within 
>> Fineract but are tailored for our custom logic.
>> 
>>  
>> 
>> How are the schedulers deployed across multiple servers?
>> We have two servers running the same codebase, both connected to the same 
>> database. Each server has the scheduler enabled. The job configurations, 
>> including the cron_expression, are stored in the shared job table in the 
>> database. As a result, both servers read the job configuration and 
>> independently trigger the same scheduled tasks, leading to duplicate 
>> execution.
>> 
>>  
>> 
>> Are they part of the same application instance or running independently?
>> The schedulers are running on two separate, independent application 
>> instances hosted on different servers. Each instance reads from the same 
>> database and executes the scheduler jobs individually, which is causing the 
>> duplication issue.
>> 
>>  
>> 
>> Please let me know if you need any further details or logs. I’d appreciate 
>> any suggestions on how best to manage schedulers in such a multi-server 
>> environment to prevent duplicate job executions.
>> 
>>  
>> 
>> From: Ádám Sághy <adamsa...@gmail.com <mailto:adamsa...@gmail.com>>
>> Sent: Monday, June 30, 2025 2:32 PM
>> To: dev@fineract.apache.org <mailto:dev@fineract.apache.org>
>> Subject: Re: Handling Duplicate Entries from Custom Schedulers in Fineract 
>> (Multi-Server Environment)
>> 
>>  
>> 
>> Hi Bhaskar,
>> 
>> Thank you for reaching out.
>> 
>> I’d appreciate it if you could clarify a few points to help me better 
>> understand the issue:
>> 
>> What exactly do you mean by “custom scheduler”?
>> How are the schedulers deployed across multiple servers?
>> Are they part of the same application instance or running independently?
>> A bit more detail on your setup and the logic you’ve implemented would be 
>> helpful in identifying the root cause and suggesting a solution.
>> 
>> Regards,
>> Adam
>> 
>> 
>> 
>> 
>> On 2025. Jun 30., at 10:11, Bhaskar Tiwari <bhas...@strideone.in 
>> <mailto:bhas...@strideone.in>> wrote:
>> 
>>  
>> 
>> Hi Team,
>> 
>>  
>> 
>> I’ve implemented some custom schedulers in Fineract using existing patterns. 
>> However, I’m encountering an issue with duplicate entries when two servers 
>> are running concurrently and share the same database.
>> 
>> While I’ve added logic to prevent duplicate accrual entries when schedulers 
>> are triggered multiple times, the problem arises because these schedulers 
>> are running on separate servers. As a result, each instance bypasses the 
>> duplication check, leading to duplicate accrual entries in the database.
>> 
>> Is there a recommended way to manage custom schedulers in a multi-server 
>> setup to avoid this issue?
>> 
>>  
>> 
>> Looking forward to your suggestions.
>> 
>>  
>> 
>> Regards
>> 
>> Bhaskar Tiwari
>> 
>>  
>> 
>> "Print this mail only if absolutely necessary. Save Paper. Save Trees." 
>> Disclaimer: “This electronic mail message sent from StrideOne (Stride 
>> Fintree Private Limited) may contain Confidential/Restricted/Internal 
>> information and should only be viewed by the intended recipients. Under no 
>> circumstances may any such information be disclosed, copied, used or 
>> distributed to any unauthorized persons or entities without the written 
>> consent of Strideone. If you are not the intended recipient, any review, 
>> retransmission, dissemination or reliance on the content of these materials 
>> is strictly prohibited and may be the subject of legal action. If you 
>> received this email in error, please notify the sender and delete the 
>> message immediately.”
>> 
>>  
>> 
>>  
>> 
>> "Print this mail only if absolutely necessary. Save Paper. Save Trees." 
>> Disclaimer: “This electronic mail message sent from StrideOne (Stride 
>> Fintree Private Limited) may contain Confidential/Restricted/Internal 
>> information and should only be viewed by the intended recipients. Under no 
>> circumstances may any such information be disclosed, copied, used or 
>> distributed to any unauthorized persons or entities without the written 
>> consent of Strideone. If you are not the intended recipient, any review, 
>> retransmission, dissemination or reliance on the content of these materials 
>> is strictly prohibited and may be the subject of legal action. If you 
>> received this email in error, please notify the sender and delete the 
>> message immediately.”
>> 
>>  
>> 
>>  
>> "Print this mail only if absolutely necessary. Save Paper. Save Trees." 
>> Disclaimer: “This electronic mail message sent from StrideOne (Stride 
>> Fintree Private Limited) may contain Confidential/Restricted/Internal 
>> information and should only be viewed by the intended recipients. Under no 
>> circumstances may any such information be disclosed, copied, used or 
>> distributed to any unauthorized persons or entities without the written 
>> consent of Strideone. If you are not the intended recipient, any review, 
>> retransmission, dissemination or reliance on the content of these materials 
>> is strictly prohibited and may be the subject of legal action. If you 
>> received this email in error, please notify the sender and delete the 
>> message immediately.”
>> 

Reply via email to