[JBoss Messaging] - Configuring Destinations in MDB's
by nkhadakk
JBoss Messaging 1.3/ JBoss AS (4.2.1)
We have an incoming message Queue and a pool of MDB's listening. The MDB's process the data and have to post results onto another Queue. This is the code for the posting to the reply Queue:
| @Resource(mappedName = "java:/JmsXA")
| private static QueueConnectionFactory factory;
|
| @Resource(mappedName = "/queue/ResolvedUniversalResourceQueue")
| private static Queue destinationReply;
|
| public void onMessage( Message msg)
| {
| // Process incoming msg and get it ready to be sent outward
| //
| //
| qConnection = factory.createQueueConnection();
| QueueSession qSession = qConnection.createQueueSession( false, Session.DUPS_OK_ACKNOWLEDGE);
| QueueSender qSender = qSession.createSender( destinationReply);
| qSender.send( qSession.createObjectMessage( urimsg));
| qSender.close();
| }
|
a. Is it ok to create new QueueConnections every time ? Especially since i use the java:/JMSXA connection factory ?
b. Is it ok to create Sessions and QueueSender every single invoke ?
Is there any best practice for pooling/sharing Sessions and QueueSender ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084220#4084220
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084220
18 years, 9 months
[JBoss jBPM] - Re: required variables
by dleerob
There may be another bug.
When calling taskInstance.end(), it now throws an exception (great!), but unfortunately, that exception does not stop the ending of the task instance. So the task instance is indeed considered "ended" anyway, even though you have required variables that are missing.
See the end method below, found in TaskInstance. The validation is only done when submitVariables() is called, but before that is called, a bunch of work has already taken place on the task instance.
/**
| * marks this task as done and specifies a transition
| * leaving the task-node for the case that the completion of this
| * task instances triggers a signal on the token.
| * If this task leads to a signal on the token, the given transition
| * name will be used in the signal.
| * If this task completion does not trigger execution to move on,
| * the transition is ignored.
| */
| public void end(Transition transition) {
| if (this.end!=null){
| throw new IllegalStateException("task instance '"+id+"' is already ended");
| }
| if (this.isSuspended) {
| throw new JbpmException("task instance '"+id+"' is suspended");
| }
|
| // mark the end of this task instance
| this.end = new Date();
| this.isOpen = false;
|
| // fire the task instance end event
| if ( (task!=null)
| && (token!=null)
| ) {
| ExecutionContext executionContext = new ExecutionContext(token);
| executionContext.setTask(task);
| executionContext.setTaskInstance(this);
| task.fireEvent(Event.EVENTTYPE_TASK_END, executionContext);
| }
|
| // log this assignment
| if (token!=null) {
| token.addLog(new TaskEndLog(this));
| }
|
| // submit the variables
| submitVariables();
|
| // verify if the end of this task triggers continuation of execution
| if (isSignalling) {
| this.isSignalling = false;
|
|
|
| if ( this.isStartTaskInstance() // ending start tasks always leads to a signal
| || ( (task!=null)
| && (token!=null)
| && (task.getTaskNode()!=null)
| && (task.getTaskNode().completionTriggersSignal(this))
| )
| ) {
|
| if (transition==null) {
| log.debug("completion of task '"+task.getName()+"' results in taking the default transition");
| token.signal();
| } else {
| log.debug("completion of task '"+task.getName()+"' results in taking transition '"+transition+"'");
| token.signal(transition);
| }
| }
| }
| }
Am I missing something? Should it work this way? Surely the task instance should not "end" if the required variables are not set.
I think I may need to do my own validation in my framework action class by calling startTaskInstance.getTask().getTaskController().getVariableAccesses(), then implementing my own (similair) validation function on that variable access list, and not even bother calling taskInstance.end() if my own validation fails. Would you recommend I do it this way?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084218#4084218
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084218
18 years, 9 months