Meaningless Drivel is fun!*
The moose likes Groovy and the fly likes What can I access from /grails-app/src/java (and /grails-app/src/groovy) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "What can I access from /grails-app/src/java (and /grails-app/src/groovy)" Watch "What can I access from /grails-app/src/java (and /grails-app/src/groovy)" New topic

What can I access from /grails-app/src/java (and /grails-app/src/groovy)

andrew ennamorato
Ranch Hand

Joined: Oct 03, 2007
Posts: 100
"Stole" some code from Burt Beckwith that enables some simple JMS integration into a Grails application.
In this case, the controller puts a message on a JMS queue - a listener then reads that message and writes it to the console.

The listener is just a POGO and is in /grails-app/src/groovy. I'm still learning Groovy/Grails and am curious what other objects/packages you have access to from this directory? Obviously it is being compiled in with the application (as I can see the console output), but can I access domain classes/objects here? Grails services? I'd love to make a similar listener that just updates domain-classes/objects, but sure that would work.

Also trying to avoid (for now) the Grails JMS-plugin, but if I have to use it I can. The goal is just a simple Grails app that listens to a JMS topic, and updates a DB (and therefore web page) with stats.
andrew ennamorato
Ranch Hand

Joined: Oct 03, 2007
Posts: 100
So you *can* get to domain classes from src/groovy. Still not exactly sure how/why that works, though.

A better question is, what I really need is essentially a message driven bean, but in Grails. Is there an equivalent? Do I make it a service? Better off as a POGO here in src/groovy? Or is that just a style question that's up to me?
subject: What can I access from /grails-app/src/java (and /grails-app/src/groovy)
Similar Threads
What does Groovy/Grails offer?
Grails: A Quick Start Guide Question to Dave Klein
Grails 1.1 Web Application Development
Grails Packaging Structure for Controller and Domain
[Grails] Passing user object into hiddenField