1

I have a java object for interfacing with a Weblogic JMS server. I'd like to be able to take these messages from the JMS and work with them in clojure. With my limited knowledge the best way I could think doing this would be via channels from the clojure async library. But I am unsure if I can publish to a clojure channel from a Java object.

My ideal flow would be:

  1. Java object receives message from JMS subscription
  2. Java publishes message to a channel
  3. Clojure has a thread listening to that channel and receives the message
  4. I do my processing on that message once received from the clojure channel.

I also need to make sure these messages are received in the same order I receive them from Java.

Is there a way to use the async libraries channels to work from within a java object, or am I barking up the wrong tree with this methodology?

jrahme
  • 253
  • 1
  • 12
  • 1
    maybe look at http://stackoverflow.com/questions/2181774/calling-clojure-from-java – Viktor K. Oct 06 '15 at 14:33
  • 1
    Why wouldn't you use Clojure instead of Java for 1+2? Also, you could try to think in a different direction: treat JMS as a core.async channel. See https://nvbn.github.io/2015/04/04/redis-core-async/ where somebody uses Redis commands to implement the core.async primitives. – schaueho Oct 06 '15 at 15:28

1 Answers1

0

I solved this by following the second comment at this link to create a channel in my java source. Then assigning the channel to a generic object and adding an accessor method to my java source for the channel.

Community
  • 1
  • 1
jrahme
  • 253
  • 1
  • 12