Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def event_from_message(msg)
- if msg.class.to_s == 'Runnels::Message'
- fields = msg.fields
- elsif msg.class.to_s == 'Stomp::Message'
- if msg.headers["destination"] =~ /^\/topic\/runnels\//
- fields = JSON.parse(msg.body)['fields']
- else
- fields = YAML.load(msg.body)
- end
- else
- fields = nil
- end
- event = CSeventRunnels.from_hash(fields)
- unless event
- raise "Unable to create event from #{msg.inspect}"
- end
- return event
- end
Add Comment
Please, Sign In to add comment