JBoss Community

Re: Issue with timer and calendar

created by srikant vege in jBPM - View the full discussion

Hi,

 

Thanks for you help. Now I got another issue.

 

I have 2 rules (mentioned below). 1st rule should be executed on weekdays and the next rule should be executed on Holidays.

 

rule "week days rule"

    ruleflow-group "os-cron-service"

    calendars "weekDayCalendar"

    timer (int:0 5s)

    when

        Alarm()

    then

        System.out.println("Week Days rule executed..");

end

 

rule "holiday rule"

    ruleflow-group "os-cron-service"

    calendars "holidayCalendar"

    timer (int:0 5s)

    when

      Alarm()

    then

        System.out.println("Holidays rule executed..");

end

 

I have created two calendar objects (one is for weekdays & another for holidays) and set them to ksession. below is the code.

 

WeeklyCalendar weekCalendar = new WeeklyCalendar();

Calendar weekDaysCalendar= QuartzHelper.quartzCalendarAdapter(weekCalendar);

ksession.getCalendars().set("weekDayCalendar", weekDaysCalendar);

 

HolidayCalendar holidayCalendar = new HolidayCalendar();

Calendar holidayCal = QuartzHelper.quartzCalendarAdapter(holidayCalendar);

ksession.getCalendars().set("holidayCalendar", holidayCal);

 

When I execute the rules, both the rules are getting executed and it seems like it is not considering the calendar objects. I even tried with CronCalendar also by giving the cron expression. But no luck.

 

Please let me know the mistake that I am doing here. I am using drools 5.3 and jbpm 5.2

 

Thanks

Srikant.

Reply to this message by going to Community

Start a new discussion in jBPM at Community