[jBPM] - How to new a StatefulKnowledgeSession instance
by RuiHua Tang
RuiHua Tang [http://community.jboss.org/people/trh3037] created the discussion
"How to new a StatefulKnowledgeSession instance"
To view the discussion, visit: http://community.jboss.org/message/612473#612473
--------------------------------------------------------------
I have used JBPM5 in Spring Web Application
First, I use the following method to create:
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
But, I found that process data and session have not saved to the database
When I use the following methods:
EntityManagerFactory emf = (EntityManagerFactory) Constants.ctx
.getBean("entityManagerFactory");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices
.getTransactionManager());
// Properties properties = new Properties();
// properties
// .put("drools.processInstanceManagerFactory",
// "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
// properties.put("drools.processSignalManagerFactory",
// "org.jbpm.persistence.processinstance.JPASignalManagerFactory");
// KnowledgeSessionConfiguration config = KnowledgeBaseFactory
// .newKnowledgeSessionConfiguration(properties);
StatefulKnowledgeSession session = JPAKnowledgeService
.newStatefulKnowledgeSession(kbase, null, env);
// StatefulKnowledgeSession session =
// kbase.newStatefulKnowledgeSession();
return session;
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/612473#612473]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 9 months
[JBoss Messaging] - Want to add MessageListener to Programmatically create Queue forever
by Navnath Kumbhar
Navnath Kumbhar [http://community.jboss.org/people/navnath] created the discussion
"Want to add MessageListener to Programmatically create Queue forever"
To view the discussion, visit: http://community.jboss.org/message/612425#612425
--------------------------------------------------------------
| |
I am creating JMS Queue at run time and trying to add Listener after creation of queue. Now I am able to bind Listener with newly create queue. Here is my sample code to bind Listener
Context ctx = new InitContex();
QueueConnectionFactory queueConnectionFactory =
(QueueConnectionFactory) ctx.lookup("java:/JmsXA");
Queue myQueue = (Queue)ctx.lookup("queue/myQueue");
QueueConnection queueConnection =
queueConnectionFactory.createQueueConnection();
QueueSessionqueueSession=queueConnection.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
javax.jms.QueueReceiver queueReceiver = queueSession.createReceiver(myQueue);
MessageListener myListener = new MyListenerBean();
queueReceiver.setMessageListener(myListener);
But using above code I need to bind Listener every time whenever I add new message in Queue. Is there any way to bind Listener at once and use it till server didn't get down.(This can be done with configure Queue in JBoss, But I want to bind Queue which I have created at run time.)
Thanks in advance. |
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/612425#612425]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 9 months
[jBPM] - How to finish the processInstance
by RuiHua Tang
RuiHua Tang [http://community.jboss.org/people/trh3037] created the discussion
"How to finish the processInstance"
To view the discussion, visit: http://community.jboss.org/message/612418#612418
--------------------------------------------------------------
I have finished all tasks for the proceeInstance , why the state of processInstance is still '1' ?
Is not what I had to deal with other cases?
My English is not good ,excuse me
Here is my code:
BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
client.start(taskId, userId, responseHandler);
responseHandler.waitTillDone(5000);
// Thread.sleep(10000);
responseHandler = new BlockingTaskOperationResponseHandler();
ContentData contentData = null;
if (data != null) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out;
try {
out = new ObjectOutputStream(bos);
out.writeObject(data);
out.close();
contentData = new ContentData();
contentData.setContent(bos.toByteArray());
contentData.setAccessType(AccessType.Inline);
} catch (IOException e) {
e.printStackTrace();
}
}
client.complete(taskId, userId, contentData, responseHandler);
responseHandler.waitTillDone(5000);
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/612418#612418]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 9 months