Hi,

I have a lot of jobs scheduled with Quartz like described in the Apache Isis documentation [1] and they work perfectly. But now for a new job I get the following exception when it is finished:

Caused by: javax.jdo.JDODataStoreException: Insert of object "org.isisaddons.module.command.dom.CommandJdo@3dd5db8c" using statement "INSERT INTO Command (arguments,completedAt,`exception`,executeIn,memberIdentifier,memento,parentTransactionId,`result`,startedAt,targetAction,targetClass,target,`timestamp`,`user`,transactionId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" failed : Column 'memberIdentifier' cannot be null
NestedThrowables:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'memberIdentifier' cannot be null

The method that is executed by the job is:

public void provisionSIPTrunks(){
Query q = isisJdoSupport.getJdoPersistenceManager().newQuery(SIPSubscription.class);
    q.setFilter("begin <= today && sipTrunk.activated == false ");
    q.declareParameters(LocalDate.class.getName() +" today");
List<SIPSubscription> sipTrunks = (List<SIPSubscription>)q.execute(LocalDate.now());

    for (SIPSubscription trunk : sipTrunks) {
        trunk.startProvisioning();
}
}

When I create an empty method it works. The startProvisioning()-method basically sets a boolean and after that an ObjectUpdatedEvent is triggered and handled by a subscriber. When I disable the updatedLifeCycleEvent it works and no Command is saved at all.

The subscriber for the ObjectUpdatedEvent creates a command to be executed the BackgroundCommandService. When I create an empty subscriber method (so no command to be created) it works. But than no background job is started.

The following method of domain object SIPTrunk should be executed in the background:

public void updateProvisioning(){
    // ....
}

At first I implemented this by using the BackgroundService to execute it like

@Subscribe
public void on(SIPTrunk.UpdatedEvent ev) throws Exception {
    backgroundService.execute(ev.getSource()).updateProvisioning();
}

This did save the command to be executed with executeIn = BACKGROUND but results in the above exception. Then I tried annotating the method with @Action like this: @Action(command = CommandReification.ENABLED, commandExecuteIn = CommandExecuteIn.BACKGROUND)
public void updateProvisioning(){
    // ....
}

and triggering it like this

@Subscribe
public void on(SIPTrunk.UpdatedEvent ev) throws Exception {
    ev.getSource().updateProvisioning();
}

This doesn't execute the method in the background but immediately executes it and doesn't save the method as a command.

Any hints for getting this done?

Thanks,
Erik

[1] https://isis.apache.org/guides/ugbtb.html#5.2.1.-background-execution



Reply via email to