Commit e62d34a5 authored by Steven Pisarski's avatar Steven Pisarski

For Amdocs POC

parent 23adb892
Pipeline #803 skipped
package com.cablelabs.eventgen
import _root_.akka.actor.Props
import _root_.akka.camel.Consumer
import _root_.akka.camel.{CamelMessage, Consumer}
import com.cablelabs.eventgen.akka.GeneratorActors
import org.apache.activemq.camel.component.ActiveMQComponent
......@@ -42,7 +42,7 @@ object TestActors {
*/
class CamelConsumer(val endpointUri: String, val notifier: Notifier) extends Consumer {
def receive = {
case msg => notifier.notify(msg)
case msg: CamelMessage => notifier.notify(msg)
}
}
......@@ -51,9 +51,9 @@ class CamelConsumer(val endpointUri: String, val notifier: Notifier) extends Con
*/
class Notifier {
var list = new mutable.ArrayBuffer[Any]()
def notify(msg: Any) = {
def notify(msg: CamelMessage) = {
list += msg
println(msg)
println(msg.body)
}
}
......@@ -84,3 +84,51 @@ object Sub extends App {
System.out.println(message)
}
}
object PubAmdocsProto extends App {
val uri = "amqp://zutmawnt:ywqbdohUdNAUsX6Ej4ZwCnD9ShZRm4Ns@tiger.cloudamqp.com/zutmawnt"
// val uri = "amqp://localhost"
val factory = new ConnectionFactory()
factory.setUri(uri)
val connection = factory.newConnection()
val channel = connection.createChannel()
channel.queueDeclare("RabbitMqRouterTest", false, false, false, null)
channel.exchangeDeclare("test_exchange", "topic")
var ctr = 0;
while(true) {
ctr += 1
val message = s"Hello from Pub ${System.currentTimeMillis()}!"
channel.basicPublish("test_exchange", "routing_key", null, message.getBytes)
println(" [x] Sent '" + message + "'" + "#" + ctr)
Thread.sleep(1000)
}
}
object SubAmdocsProto extends App {
val uri = "amqp://zutmawnt:ywqbdohUdNAUsX6Ej4ZwCnD9ShZRm4Ns@tiger.cloudamqp.com/zutmawnt"
// val uri = "amqp://admin:admin@tiger.cloudamqp.com"
// val uri = "amqp://localhost"
val factory = new ConnectionFactory()
factory.setUri(uri)
val connection = factory.newConnection()
val channel = connection.createChannel()
channel.exchangeDeclare("test_exchange", "topic")
// channel.queueDeclare("RabbitMqRouterTest", false, false, false, null)
// channel.queueDeclare("CMHealthXML", false, false, false, null)
// channel.queueDeclare("hello", false, false, false, null)
val queueName = channel.queueDeclare().getQueue
channel.queueBind(queueName, "test_exchange", "routing_key")
// channel.queueDeclare("RabbitMqRouterTest", false, false, false, null)
val consumer = new QueueingConsumer(channel)
// channel.basicConsume("hello", true, consumer)
channel.basicConsume(queueName, true, consumer)
while (true) {
val delivery = consumer.nextDelivery()
val message = new String(delivery.getBody)
// System.out.println(s" [x] Received '$message' at ${System.currentTimeMillis()}")
System.out.println(message)
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ temporal:
algo:
name: constant
constType: integer
constVal: 1000
constVal: 5000
dimensions:
- name: DOCSISVersion
description: The version of DOCSIS supported by the Cable Modem
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment