Custom automation with Seam backing Bean, How long is the SEAM conversation?

I'm attempting to implement a stack which will be available during a long running SEAM conversation. I want to be able to backtrack through the lifecycle states of a document and I'm using the stack to store the previous N states as Strings. The document moves through the lifecycle states and reveals, in the edit view, properties for editing based on the lifecycle state. One of the questions I have is “how long” does the SEAM conversation stay active for a document being edited?

I've built a simple push and pop automation operations which load and are called correctly. The backing bean was generated using the IDE as a SEAM service bean. I changed the Scope in that bean from event to CONVERSATION.

The Stack itself is a standard Java stack extended to change the name only.

I get an null pointer error on the stack reference when I try a PUSH a string onto this custom stack. I am injecting a reference to the stack into the push and pop automation operation classes . It seems the SEAM backing bean is not being initialized.

Here is the backing bean code and the push and pop classes: The two log messages are never printed in the backing bean, the Push log message getting the previous state from the Document Model prints.

@Name(“bESStateStack”) @Scope(ScopeType.CONVERSATION) public class BESStateStackBean implements Serializable {

private static final long serialVersionUID = 1L;

protected BESStateStack<String> bESStateStack;



private static final Log log = LogFactory.getLog(BESStateStackBean.class);



@Unwrap
public BESStateStack<String> getService() throws Exception {
    log.warn("Getting Service BESStateStackBean");
    if (bESStateStack == null) {
        log.warn ("Creating BESStateStackBean");
        bESStateStack = Framework.getService(BESStateStack.class);
    }
    return bESStateStack;
}



public BESStateStack<String> getbESStateStack() {
    return bESStateStack;
}



public void setbESStateStack(BESStateStack<String> bESStateStack) {
    this.bESStateStack = bESStateStack;
}

}

@Operation(id=PopBESState.ID, category=Constants.CAT_EXECUTION_STACK, label=“PopBESState”, description=““) public class PopBESState {

public static final String ID = "PopBESState";

@In (value="#{bESStateStack}")
BESStateStack<String> stack;

private static final Log log = LogFactory.getLog(PopBESState.class);



@OperationMethod
public DocumentModel run(DocumentModel input) {
    try {
        String x = (String)stack.pop();
        log.warn("Stack pop state = "+ x);
        input.setProperty("bespreviousstate", "previousstate", x);
    } catch (ClientException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
  return input; 
}    

}

@Operation(id=PushBESState.ID, category=Constants.CAT_EXECUTION_STACK, label=“PushBESState”, description=““) public class PushBESState {

@In (value="#{bESStateStack}",create=true)
BESStateStack<String> stack;

public static final String ID = "PushBESState";


private static final Log log = LogFactory.getLog(PushBESState.class);



@OperationMethod
public DocumentModel run(DocumentModel input) {

   try {
       String x = (String)input.getProperty("bespreviousstate", "previousstate");
       log.warn("state = "+ x);
       stack.push(x);
} catch (ClientException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
   return input;

}    

}

0 votes

2 answers

1206 views

ANSWER



It's defined in nuxeo-services > /nuxeo-platform-web-common/src/main/resources/OSGI-INF/deployment-fragment.xml

I think you can override it by creating your own deployment-fragment.xml and redefining “components#SEAM_CORE_MANAGER”

<extension target="components#SEAM_CORE_MANAGER" mode="replace">
    <property name="conversationTimeout">180000</property><!-- should be 30 min but is 3 min !! -->
    <property name="concurrentRequestTimeout">1000</property><!-- 1s -->
</extension>
1 votes



I think the seam conversation timeout is 30 minutes but it was fixed recently and was previously sets to 3minutes. See : NXP-9022 - https://jira.nuxeo.com/browse/NXP-9022 Version fixed : 5.4.1-HF17, 5.4.2-HF19, 5.5.0-HF05, 5.6

0 votes