Re: [Lift] Re: [lift] Lift based backend server subscribing via amqp

2010-01-06 Thread vishnu
hi
   well I'm mostly going by this stack overflow post.
http://stackoverflow.com/questions/1140448/what-orms-work-well-with-scala
In terms of our requirements, what we want from an orm is fairly basic.
Since we are not building a web application, we would want it decoupled from
any other parts of such a stack. (I heard mapper depends on the http
module?). We need most of the basic orm operations with ACID compliance,
preferably one that requires us to write as little code as possible and
includes transactionality as something we can depend upon. The database
we're currently looking at is Postgresql, so ideally the ORM should be
oblivious of whether or not the database is distributed.


I understand it's a bit vague. In terms of what we need right now, we need
ACID and

On Tue, Jan 5, 2010 at 6:39 PM, Timothy Perrett timo...@getintheloop.euwrote:

 In what way do you mean is mapper worth it?

 What kind of system is it? do you need ACID or BASE? What kind of load
 will the system be under? Do you need it to be distributed? You are
 not restricted to Mapper, you could use JPA or whatever persistence
 you want with lift.

 If you just want to make a pretty simple service tier, then sure, Lift
 will be fine. Akka works well when you need fault tolerance or
 distributed nodes etc etc

 Cheers, Tim

 On Jan 5, 3:34 am, 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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@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
 

Re: [Lift] Re: [lift] Lift based backend server subscribing via amqp

2010-01-05 Thread Timothy Perrett
We don't accept patches for legal reasons. However, I will upgrade the  
module today for you - giving a similar result.

Cheers, Tim

Sent from my iPhone

On 5 Jan 2010, at 04:29, Franz Bettag fr...@bett.ag wrote:

 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
   artifactIdlift-amqp/artifactId

 +  repositories
 +repository
 +  idnexus.griddynamics.net/id
 +  nameNexus Maven2 Repository/name
 +  urlhttps://nexus.griddynamics.net/nexus/content/groups/
 public/url
 +/repository
 +  /repositories
 +
 +
   !-- properties/ --

   !--
 @@ -55,8 +64,8 @@
 /dependency
 dependency
   groupIdcom.rabbitmq/groupId
 -  artifactIdrabbitmq-client/artifactId
 -  version1.3.0/version
 +  artifactIdamqp-client/artifactId
 +  version1.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 = 

[Lift] Re: [lift] Lift based backend server subscribing via amqp

2010-01-05 Thread Timothy Perrett
In what way do you mean is mapper worth it?

What kind of system is it? do you need ACID or BASE? What kind of load
will the system be under? Do you need it to be distributed? You are
not restricted to Mapper, you could use JPA or whatever persistence
you want with lift.

If you just want to make a pretty simple service tier, then sure, Lift
will be fine. Akka works well when you need fault tolerance or
distributed nodes etc etc

Cheers, Tim

On Jan 5, 3:34 am, 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.euwrote:



  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.comliftweb%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.comliftweb%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.comliftweb%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.




[Lift] Lift based backend server subscribing via amqp

2010-01-04 Thread vishnu
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.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




Re: [Lift] Lift based backend server subscribing via amqp

2010-01-04 Thread Timothy Perrett
Hi,

No, the AMQP module hasnt had any work for some time... I think im the only 
person actually using it.

Check my article about it here: http://is.gd/5LZ34

Cheers, Tim

On 4 Jan 2010, at 15:34, vishnu 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.
 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.




[Lift] Re: [lift] Lift based backend server subscribing via amqp

2010-01-04 Thread Channing Walton

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.
 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-tp27014641p27018830.html
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.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




Re: [Lift] Re: [lift] Lift based backend server subscribing via amqp

2010-01-04 Thread Timothy Perrett
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.
 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-tp27014641p27018830.html
 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.
 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.




Re: [Lift] Lift based backend server subscribing via amqp

2010-01-04 Thread Kris Nuttycombe
On Mon, Jan 4, 2010 at 8:48 AM, Timothy Perrett timo...@getintheloop.eu wrote:
 Hi,

 No, the AMQP module hasnt had any work for some time... I think im the only 
 person actually using it.

 Check my article about it here: http://is.gd/5LZ34

 Cheers, Tim


Nope! We're using it in production as well. :)

Kris

 On 4 Jan 2010, at 15:34, vishnu 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.
 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.




--

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.




Re: [Lift] Lift based backend server subscribing via amqp

2010-01-04 Thread Timothy Perrett
oh super awesome! I had no idea!! 

Cheers, Tim

On 4 Jan 2010, at 21:06, Kris Nuttycombe wrote:

 Nope! We're using it in production as well. :)

--

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.




Re: [Lift] Re: [lift] Lift based backend server subscribing via amqp

2010-01-04 Thread vishnu
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.euwrote:

 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.comliftweb%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-tp27014641p27018830.html
  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.comliftweb%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.comliftweb%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.




[Lift] Re: [lift] Lift based backend server subscribing via amqp

2010-01-04 Thread Franz Bettag
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
   artifactIdlift-amqp/artifactId

+  repositories
+repository
+  idnexus.griddynamics.net/id
+  nameNexus Maven2 Repository/name
+  urlhttps://nexus.griddynamics.net/nexus/content/groups/
public/url
+/repository
+  /repositories
+
+
   !-- properties/ --

   !--
@@ -55,8 +64,8 @@
 /dependency
 dependency
   groupIdcom.rabbitmq/groupId
-  artifactIdrabbitmq-client/artifactId
-  version1.3.0/version
+  artifactIdamqp-client/artifactId
+  version1.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 =