Hey guys,

i've just updated the amqp code. I started a pull request on github
but that seems *not* to be the proper way *smirking @dpp's auto-
reply*.

Anyway here is the patch. The problem was that in version 1.5.0 of
rabbitmq's library, the ticket-stuff was removed.

diff --git a/lift-modules/lift-amqp/pom.xml b/lift-modules/lift-amqp/
pom.xml
index 9f4c1d5..424be0e 100644
--- a/lift-modules/lift-amqp/pom.xml
+++ b/lift-modules/lift-amqp/pom.xml
@@ -32,6 +32,15 @@
   </parent>
   <artifactId>lift-amqp</artifactId>

+  <repositories>
+    <repository>
+      <id>nexus.griddynamics.net</id>
+      <name>Nexus Maven2 Repository</name>
+      <url>https://nexus.griddynamics.net/nexus/content/groups/
public</url>
+    </repository>
+  </repositories>
+
+
   <!-- <properties/> -->

   <!--
@@ -55,8 +64,8 @@
     </dependency>
     <dependency>
       <groupId>com.rabbitmq</groupId>
-      <artifactId>rabbitmq-client</artifactId>
-      <version>1.3.0</version>
+      <artifactId>amqp-client</artifactId>
+      <version>1.7.0</version>
     </dependency>
   </dependencies>

diff --git a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
AMQPDispatcher.scala b/lift-modules/lift-amqp/src/main/scala/net/
liftweb/amqp/AMQPDispatcher.scala
index 26bca73..96c66c9 100644
--- a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
AMQPDispatcher.scala
+++ b/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
AMQPDispatcher.scala
@@ -91,7 +91,7 @@ abstract class AMQPDispatcher[T](cf:
ConnectionFactory, host: String, port: Int)
 class SerializedConsumer[T](channel: Channel, a: LiftActor) extends
DefaultConsumer(channel) {
   override def handleDelivery(tag: String, env: Envelope, props:
AMQP.BasicProperties, body: Array[Byte]) {
     val routingKey = env.getRoutingKey
-    val contentType = props.contentType
+    val contentType = props.getContentType
     val deliveryTag = env.getDeliveryTag
     val in = new ObjectInputStream(new ByteArrayInputStream(body))
     val t = in.readObject.asInstanceOf[T];
@@ -109,14 +109,12 @@ class SerializedConsumer[T](channel: Channel, a:
LiftActor) extends DefaultConsu
 class ExampleSerializedAMQPDispatcher[T](factory: ConnectionFactory,
host: String, port: Int)
     extends AMQPDispatcher[T](factory, host, port) {
   override def configure(channel: Channel) {
-    // Get the ticket.
-    val ticket = channel.accessRequest("/data")
     // Set up the exchange and queue
-    channel.exchangeDeclare(ticket, "mult", "direct")
-    channel.queueDeclare(ticket, "mult_queue")
-    channel.queueBind(ticket, "mult_queue", "mult", "routeroute")
+    channel.exchangeDeclare("mult", "direct")
+    channel.queueDeclare("mult_queue")
+    channel.queueBind("mult_queue", "mult", "routeroute")
     // Use the short version of the basicConsume method for
convenience.
-    channel.basicConsume(ticket, "mult_queue", false, new
SerializedConsumer(channel, this))
+    channel.basicConsume("mult_queue", false, new SerializedConsumer
(channel, this))
   }
 }

diff --git a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
AMQPSender.scala b/lift-modules/lift-amqp/src/main/scala/net/liftweb/
amqp/AMQPSender.scala
index 2c60ed6..dc29a2a 100644
--- a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
AMQPSender.scala
+++ b/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
AMQPSender.scala
@@ -14,11 +14,6 @@ import _root_.java.io.ObjectOutputStream
 abstract class AMQPSender[T](cf: ConnectionFactory, host: String,
port: Int, exchange: String, routingKey: String) extends LiftActor {
   val conn = cf.newConnection(host, port)
   val channel = conn.createChannel()
-  val ticket = configure(channel)
-  /**
-   * Override this to use your own AMQP queue/exchange with the given
channel.
-   */
-  def configure(channel: Channel): Int

   def send(msg: T) {
     // Now write an object to a byte array and shove it across the
wire.
@@ -26,7 +21,7 @@ abstract class AMQPSender[T](cf: ConnectionFactory,
host: String, port: Int, exc
     val store = new ObjectOutputStream(bytes)
     store.writeObject(msg)
     store.close
-    channel.basicPublish(ticket, exchange, routingKey, null,
bytes.toByteArray)
+    channel.basicPublish(exchange, routingKey, null,
bytes.toByteArray)
   }

   protected def messageHandler = {
@@ -46,12 +41,6 @@ abstract class AMQPSender[T](cf: ConnectionFactory,
host: String, port: Int, exc
  * consider creating Actor-based Senders, that will help your
application to scale.
  */
 class StringAMQPSender(cf: ConnectionFactory, host: String, port:
Int, exchange: String, routingKey: String) extends AMQPSender[String]
(cf, host, port, exchange, routingKey) {
-  override def configure(channel: Channel) = {
-    val conn = cf.newConnection(host, port)
-    val channel = conn.createChannel()
-    val ticket = channel.accessRequest("/data")
-    ticket
-  }
 }

 /**
@@ -90,13 +79,12 @@ object ExampleDirectAMQPSender {
     val factory = new ConnectionFactory(params)
     val conn = factory.newConnection(host, port)
     val channel = conn.createChannel()
-    val ticket = channel.accessRequest("/data")
     // Now write an object to a byte array and shove it across the
wire.
     val bytes = new ByteArrayOutputStream
     val store = new ObjectOutputStream(bytes)
     store.writeObject(msg)
     store.close
-    channel.basicPublish(ticket, "mult", "routeroute", null,
bytes.toByteArray)
+    channel.basicPublish("mult", "routeroute", null,
bytes.toByteArray)
   }
 }


On 5 Jan., 04:34, vishnu <path...@gmail.com> wrote:
> well I'm not sure how to describe it differently. As you said it's only
> service tier. The truth is I dont know anything about Lift yet and Im just
> now running through some basic Scala books.
>
> I need a library with which to talk to rabbitmq as a subscriber that might
> work at a higher level than the default java api that comes with rabbitmq
> and ideally something that provides the same service for me talk to a
> database via scala. I haven't seen Akka before, so I'll take a look at that
> :). Would you say mapper is worth it?
>
> On Tue, Jan 5, 2010 at 2:23 AM, Timothy Perrett 
> <timo...@getintheloop.eu>wrote:
>
> > It depends on your use case... you don't really describe exactly what you
> > want to do. Perhaps start by providing more detail? If you want service teir
> > *only* though, its quite probable that akka would be a better fix.
>
> > Cheers, Tim
>
> > On 4 Jan 2010, at 20:30, Channing Walton wrote:
>
> > > Maybe Akka would be better for you?http://akkasource.org/
> > > "Akka has an AMQP module which abstracts AMQP Producer and Consumer as
> > > Actors."
>
> > > Channing
>
> > > vishnu-11 wrote:
>
> > >> Hi
> > >>   I'm trying to use lift to right a back end for a system that
> > >> communicates via AMQP. The idea is to have a bunch of (threads?,
> > >> processes? actors?) that subscribe to some queues on a queueing system
> > >> and react to various messages by contacting various third party
> > >> systems and persisting messages to a database.
>
> > >> I was wondering firstly if it makes sense to use lift, or if it makes
> > >> more sense to pull various parts out of lift and use them?
>
> > >> Additionally, looking at the lift amqp code, it seems to be a little
> > >> out of date, especially with regard to amqp. Does anyone know if there
> > >> has been any active work on this segment?
>
> > >> --
>
> > >> You received this message because you are subscribed to the Google
> > Groups
> > >> "Lift" group.
> > >> To post to this group, send email to lift...@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> > .
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/liftweb?hl=en.
>
> > > --
> > > View this message in context:
> >http://old.nabble.com/Lift-based-backend-server-subscribing-via-amqp-...
> > > Sent from the liftweb mailing list archive at Nabble.com.
>
> > > --
>
> > > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > > To post to this group, send email to lift...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to