Skip to content
This repository was archived by the owner on Jun 11, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,40 @@ So it kind of works and will be maintained for some time :-)

```xml
<repositories>
<repository>
<id>sstone snapshots</id>
<url>http://sstone.github.com/sstone-mvn-repo/snapshots</url>
</repository>
<repository>
<id>sstone releases</id>
<url>http://sstone.github.com/sstone-mvn-repo/releases</url>
</repository>
<repository>
<id>sonatype snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.aphelia</groupId>
<artifactId>amqp-client_2.9.2</artifactId>
<groupId>com.github.sstone</groupId>
<artifactId>amqp-client_SCALA-VERSION</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor</artifactId>
<version>2.0.3</version>
<artifactId>akka-actor</artifactId> <!-- for Akka 2.0.X -->
<artifactId>akka-actor_SCALA-VERSION</artifactId> <!-- for Akka 2.1.X -->
<version>AKKA-VERSION</version>
</dependency>
</dependencies>
```

Please note that the Akka dependency is now in the "provided" scope which means that you'll have to define it explicitely in your
maven/sbt projects.

The latest snapshot (development) version is 1.1-SNAPSHOT, the latest released version is 1.0
The latest snapshot (development) version is 1.1-SNAPSHOT, the latest released version is 1.1-RC1. They are both compatible with
Akka 2.1.0/Scala 2.10 and Akka 2.0.5/Scala 2.9.2

Version 1.0 was packaged with groupdId set to com.aphelia and uploaded to my own mvn repository (http://sstone.github.com/sstone-mvn-repo/{snapshots/releases}).
From version 1.1 on, snapshots are uploaded to https://oss.sonatype.org/content/repositories/snapshots and releases are synced to maven central.

## Compatibility with Scala 2.10

Master is currently developped against 2.9.2, branch scala2.10 against 2.10.0


## Library design

Expand Down
62 changes: 55 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
Expand All @@ -8,7 +7,7 @@
</parent>
<groupId>com.github.sstone</groupId>
<artifactId>amqp-client_${scala.version}</artifactId>
<version>1.1-SNAPSHOT</version>
<version>1.1.1</version>
<packaging>jar</packaging>
<name>amqp-client</name>
<description>Simple AMQP client for Scala/Akka</description>
Expand All @@ -17,7 +16,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.9.2</scala.version>
<akka.version>2.0.3</akka.version>
<akka.version>2.0.5</akka.version>
</properties>

<licenses>
Expand Down Expand Up @@ -50,6 +49,7 @@
</plugin>
</plugins>
</reporting>

<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<plugins>
Expand All @@ -58,8 +58,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -117,6 +117,12 @@
<goal>testCompile</goal>
</goals>
</execution>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>doc-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
Expand All @@ -135,6 +141,13 @@
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<pushChanges>false</pushChanges>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -147,10 +160,15 @@
</repositories>

<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.0.1</version>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
Expand Down Expand Up @@ -189,4 +207,34 @@
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
2 changes: 1 addition & 1 deletion src/main/scala/com/github.sstone/amqp/Amqp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object Amqp {
*/
case class ChannelParameters(qos: Int)

case class Binding(exchange: ExchangeParameters, queue: QueueParameters, routingKey: String)
case class Binding(exchange: ExchangeParameters, queue: QueueParameters, routingKey: String, consumeOnly: Boolean = false)

/**
* requests that can be sent to a ChannelOwner actor
Expand Down
7 changes: 5 additions & 2 deletions src/main/scala/com/github.sstone/amqp/Consumer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ class Consumer(bindings: List[Binding], listener: Option[ActorRef], channelParam
private def setupBinding(consumer: DefaultConsumer, binding: Binding) = {
val channel = consumer.getChannel
val queueName = declareQueue(channel, binding.queue).getQueue
declareExchange(channel, binding.exchange)
channel.queueBind(queueName, binding.exchange.name, binding.routingKey)
log.info("binding to queue {}", queueName)
if (!binding.consumeOnly) {
declareExchange(channel, binding.exchange)
channel.queueBind(queueName, binding.exchange.name, binding.routingKey)
}
channel.basicConsume(queueName, autoack, consumer)
}

Expand Down