Skip to content

Instantly share code, notes, and snippets.

@kennystone
Created April 25, 2010 18:51
Show Gist options
  • Save kennystone/378624 to your computer and use it in GitHub Desktop.
Save kennystone/378624 to your computer and use it in GitHub Desktop.
require 'connamara_api'
require 'serializer/protobuf/protobuf'
require 'pub/activemq/publisher'
include Connamara
## start
config = {'connect_string'=>"tcp://localhost:61616"}
api = ConnamaraAPI.run( config, Connamara::ProtoBuf, Connamara::AMQPublisher )
## publish
api.publish( :Execution, :Quantity=>100.5, :Price=>10.4025, :UpdateTime=>Time.now )
## subscribe
api.subscribe( :Position ) { |position| puts "I got a position: " + position.inspect }
## error callback
api.error { |err| puts "received an error " + err.inspect }
## stop
api.stop
exit!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment