Archiving a bunch of old stuff

This commit is contained in:
Dan Buch
2015-06-22 13:15:42 -05:00
parent a6ec1d560e
commit bd1abd8734
395 changed files with 1 additions and 76 deletions

43
oldstuff/sylvilagus/scala/.gitignore vendored Normal file
View File

@@ -0,0 +1,43 @@
# use glob syntax.
syntax: glob
*.ser
*.class
*~
*.bak
#*.off
*.old
.env
# eclipse conf file
.settings
.classpath
.project
.manager
.scala_dependencies
# idea
.idea
*.iml
# building
target
build
null
tmp*
temp*
dist
test-output
build.log
# other scm
.svn
.CVS
.hg*
# switch to regexp syntax.
# syntax: regexp
# ^\.pc/
#SHITTY output not in target directory
build.log

View File

@@ -0,0 +1,3 @@
#!/bin/bash
cd $(dirname $(dirname $0))
mvn scala:run -Dlauncher=ch02-hello-world-producer -DaddArgs="$1"

View File

@@ -0,0 +1,11 @@
import AssemblyKeys._
assemblySettings
name := "sylvilagus"
version := "0.1.0"
scalaVersion := "2.9.2"
libraryDependencies += "com.rabbitmq" % "amqp-client" % "2.8.7"

View File

@@ -0,0 +1,116 @@
<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>
<groupId>com.meatballhat.sylvilagus</groupId>
<artifactId>sylvilagus</artifactId>
<version>0.1.0</version>
<name>${project.artifactId}</name>
<description>Scala stuff accumulated for RabbitMQ in Action</description>
<inceptionYear>2012</inceptionYear>
<properties>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.version>2.9.2</scala.version>
</properties>
<!--
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
-->
<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>2.8.7</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.scala-tools.testing</groupId>-->
<!--<artifactId>specs_${scala.version}</artifactId>-->
<!--<version>1.6.5</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
<configuration>
<launchers>
<launcher>
<id>ch02-hello-world-producer</id>
<mainClass>com.meatballhat.sylvilagus.ch02.HelloWorldProducer</mainClass>
</launcher>
</launchers>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<!-- If you have classpath issue like NoDefClassError,... -->
<!-- useManifestOnlyJar>false</useManifestOnlyJar -->
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,3 @@
resolvers += Resolver.url("Artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.5")

View File

@@ -0,0 +1,25 @@
package com.meatballhat.sylvilagus.ch02
import com.rabbitmq.client._
object HelloWorldConsumer extends App {
val factory = new ConnectionFactory()
factory.setUri(sys.env("SYLVILAGUS_AMQP_URI"))
val connection = factory.newConnection
val channel = connection.createChannel
channel.exchangeDeclare("hello-exchange", "direct", true)
channel.queueDeclare("hello-queue", false, false, false, null)
var consumer = new QueueingConsumer(channel)
channel.basicConsume("hello-queue", true, consumer)
println("Waiting for messages...")
while (true) {
new String(consumer.nextDelivery.getBody) match {
case "quit" => println("Exiting..") ; connection.close ; exit
case msg@_ => println("Received '%s'".format(msg))
}
}
}

View File

@@ -0,0 +1,24 @@
package com.meatballhat.sylvilagus.ch02
import com.rabbitmq.client._
object HelloWorldProducer extends App {
if (args.length < 1) {
println("You must provide a message argument")
exit
}
var messageBody = args(0)
var factory = new ConnectionFactory()
factory.setUri(sys.env("SYLVILAGUS_AMQP_URI"))
var connection = factory.newConnection()
var channel = connection.createChannel()
channel.exchangeDeclare("hello-exchange", "direct", true)
channel.queueDeclare("hello-queue", false, false, false, null)
printf("Publishing '%s'\n", messageBody)
channel.basicPublish("hello-exchange", "hola", null, messageBody.getBytes())
connection.close()
}