Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Introducing JMSscala

DZone's Guide to

Introducing JMSscala

· Java Zone ·
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.


JMSscala is a Scala Library to invoke JMS, the Java Message System.

It provides Scala interfaces, metaphors and conversions that lead to tighter code and less boilerplate.

e.g.

val q=session.queue("yikes")      
val messageConsumer = q.consumer
    // clean up queue, consuming all messages
messageConsumer.purge

val prod = q.producer.deliveryMode(NON_PERSISTENT).send("Hello").send("World")

prod.sendMapWith(Map("one" -> 1, "two" -> 2))
 {_.propertiesMap(Map("someprop" -> "hello", "anotherprop" -> "Goodbye"))}

val messages=q.browser().messages
  println(messages.map{
    case mess:TextMessage=>mess.asText
    case mess:MapMessage=>mess.asMap
  }.map("BROWSE "+_).mkString("\n"))

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}