0

Im using the JMS plugin 'org.grails.plugins:jms:2.0.0.M1' in my grails 3.1 project. I put a message on the queue using the jmsService:

jmsService.send("msgPending", [eventType: it.msgEventType.toString(), msgEvent: messageXml]) 
{ 
   Message msg ->
   msg.setJMSDeliveryMode(DeliveryMode.PERSISTENT)
   msg.setJMSExpiration(queueTimeout)
}

This message gets consumed using a configured camel route which has an endpoint method in the same class where it is put on the que.

When the message is received I try to save an entity using the data but I get the following exception:

No Session found for current thread; nested exception is org.hibernate.

I have tried wrapping the save method with Entity.withTransaction and I also annotated the class and methods with @Transactional but still see the same issue.

Has anyone had any issues with this?

Thanks

matt_roo
  • 415
  • 3
  • 14

1 Answers1

0

By forcing a flush on the entity's save i.e entity.save(flush:true), there was no longer an error and the entity saved correctly.

When I check if there is a hibernate session attached to the entity with out flushing the save, I can see that there is. Im not sure why I have to force the flush, but its working now.

matt_roo
  • 415
  • 3
  • 14