Created
February 7, 2012 07:15
-
-
Save lusis/1757907 to your computer and use it in GitHub Desktop.
zeromq filter support examples
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
require 'rubygems' | |
require 'ffi-rzmq' | |
require "json" | |
context = ZMQ::Context.new | |
socket = context.socket(ZMQ::REP) | |
socket.bind("tcp://*:2121") | |
msg = '' | |
puts "starting up" | |
while true do | |
socket.recv_string(msg) | |
puts "Recieved message: #{msg}" | |
modified_message = JSON.parse(msg) | |
modified_message["@message"] = "changed externally" | |
modified_message["@source_path"] = "fuck you" | |
puts "Modified message: #{modified_message.to_json}" | |
socket.send_string(modified_message.to_json) | |
end |
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
input { stdin { type => "stdin-test" } } | |
filter { zeromq { } } | |
output { stdout { debug => true }} |
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
require 'rubygems' | |
require 'ffi-rzmq' | |
require "json" | |
context = ZMQ::Context.new | |
socket = context.socket(ZMQ::REP) | |
socket.bind("tcp://*:2121") | |
msg = '' | |
puts "starting up" | |
while true do | |
socket.recv_string(msg) | |
puts "Recieved message: #{msg}" | |
modified_message = "this field was changed externally" | |
puts "Modified message: #{modified_message}" | |
socket.send_string(modified_message) | |
end |
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
input { stdin { type => "stdin-test" } } | |
filter { zeromq { field => "@source_path" } } | |
output { stdout { debug => true }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment