siqlain
(Siqlain Hanif)
October 9, 2018, 7:14am
1
I am trying to create a module that register the provider addition attributes like the
Shifts : Morning or day shift or both , Time Period Of Shift and the on which days of the week or full week
Now what i want is the quartz scheduler that runs the specific function on daily basis. How can i do that.
I tried a quartz scheduler 1.8.9 on openmrs platform version 1.11.6 when i load the module it says Scheduler service not found and openmrs doesn’t start
Current Openmrs Version that i am running : 2.0.5
siqlain
(Siqlain Hanif)
October 9, 2018, 8:36am
2
I am configuring a quartz job but getting scheduler service not found every time i load my module
siqlain
(Siqlain Hanif)
October 9, 2018, 8:48am
3
dkayiwa
(Daniel Kayiwa)
October 9, 2018, 9:51am
4
Are your changes somewhere like on github for us to take a look?
siqlain
(Siqlain Hanif)
October 9, 2018, 10:25am
5
dkayiwa
(Daniel Kayiwa)
October 9, 2018, 10:47am
6
Can you start by fixing this error? " BeanDefinitionParsingException: Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context. Offending resource: URL [jar:file:/C:/OpenMRS/.openmrs-lib-cache/recurappointmentblocks/lib/recurappointmentblocks-api-1.0.0-SNAPSHOT.jar!/moduleApplicationContext.xml]"
siqlain
(Siqlain Hanif)
October 9, 2018, 10:55am
7
This error is because <!-- <task:annotation-driven/> --> this line is been declared twice that what this error means but i have declared it once.
If i comment this line out then openmrs won’t starts and stuck in refreshing context.
dkayiwa
(Daniel Kayiwa)
October 9, 2018, 9:15pm
8
Can you commit the change to ensure that the above error does not show up?
siqlain
(Siqlain Hanif)
October 10, 2018, 7:18am
9
Thank you for your time i have done it. I will be pushing the latest code once i wrap it up.
siqlain
(Siqlain Hanif)
October 10, 2018, 9:22am
10
This is the link for updated repository
Openmrs Recurr Tasks Module
==========================
Description
-----------
For the first iteration of this module will be able to get the providers shifts attribute and recurr their blocks daily.
E.g
Shift # 1 : 9:00am to 12:00pm
Shift # 2 : 5:00pm to 8:00pm
Recurr for Mon,Tue and Thu
So this module will get this information and creates the appointment blocks depends on the shifts time-period daily using scheduler
Installation
------------
1. Build the module to produce the .omod file.
2. Use the OpenMRS Administration > Manage Modules screen to upload and install the .omod file.
This file has been truncated. show original
dkayiwa
(Daniel Kayiwa)
October 10, 2018, 12:13pm
11
So with this updated repository, what is the current problem?
siqlain
(Siqlain Hanif)
October 10, 2018, 3:21pm
12
I have been able to run the schedule job
Now what i am doing is getting all the providers which threw this error.
https://hastebin.com/ecepopabos.cs
But i can get the providers if i manually do this
try
{
Context.openSession();
Context.authenticate(
"admin"
,
"Admin123"
);
List<Provider> providers = Context.getProviderService().getAllProviders();
}
finally
{
Context.closeSession();
}
(Maybe this is because the my scheduled methods are running on different threads that does not get the context from the main thread --> Guessing)
I have pushed the code and the omod file to the repo you can check
dkayiwa
(Daniel Kayiwa)
October 10, 2018, 4:37pm
13
Can you point us to the class where you have the code to get providers?
siqlain
(Siqlain Hanif)
October 10, 2018, 5:24pm
14
/**
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
*
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.module.recurrtasks.api.impl;
import org.openmrs.api.APIException;
import org.openmrs.api.ProviderService;
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.recurrtasks.api.RecurrTasksService;
import org.openmrs.module.recurrtasks.api.dao.RecurrTasksDao;
import org.springframework.beans.factory.annotation.Autowired;
public class RecurrTasksServiceImpl extends BaseOpenmrsService implements RecurrTasksService {
This file has been truncated. show original
This class contains the code to get all providers
This Class contains the context.getService method
dkayiwa
(Daniel Kayiwa)
October 10, 2018, 5:54pm
15
From your AppointmentBlockRecurrTask. getProviders(), can you use this? Daemon.runInDaemonThread(Runnable runnable, DaemonToken token);
dkayiwa
(Daniel Kayiwa)
October 10, 2018, 6:04pm
16
siqlain
(Siqlain Hanif)
October 11, 2018, 6:13am
17
Yeah by making module activator daemonaware. i am able to get the providers.
Now the question is how can i be able to write a cron expression if i use the idgen runnable tasks in my code.
Like i want to run this function daily at 12 :00 am
dkayiwa
(Daniel Kayiwa)
October 11, 2018, 8:12am
18
siqlain
(Siqlain Hanif)
October 11, 2018, 8:27am
19
No not from this interface. My module just got its own tasks which are going to be configured in the module.
dkayiwa
(Daniel Kayiwa)
October 12, 2018, 6:24am
20
Can we have a look at one such a task?