Created
December 21, 2011 11:30
-
-
Save vhazrati/1505697 to your computer and use it in GitHub Desktop.
Code changed as per Viktors recommendations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object PullApplicationActorLess extends App { | |
var context: ZMQ.Context = null | |
var pullSocket: ZMQ.Socket = null | |
context = ZMQ.context(5) | |
pullSocket = context.socket(ZMQ.PULL) | |
pullSocket.connect("tcp://127.0.0.1:5555") | |
println("Starting consumer ...") | |
while (true) { | |
val request = pullSocket.recv(0) | |
val requestString = new String(request) | |
println(System.currentTimeMillis()) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object PushApplicationActorLess extends App { | |
val TOTAL_MESSAGES = 1000000 | |
val xmlString = XML.load("src/test/resources/benchmarks/message/message-one-s1.xml").toString.getBytes | |
var context: ZMQ.Context = null | |
var pushSocket: ZMQ.Socket = null | |
context = ZMQ.context(5) | |
pushSocket = context.socket(ZMQ.PUSH) | |
pushSocket.bind("tcp://127.0.0.1:5555") | |
Thread.sleep(10) | |
val startTime = System.currentTimeMillis | |
println("Start time - " + startTime) | |
var i = 0 | |
while (i < TOTAL_MESSAGES) { | |
pushSocket.send(xmlString, 0) | |
i += 1 | |
} | |
val endTime = System.currentTimeMillis | |
println("Publisher elapsed time " + (endTime - startTime)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment