Sha256: 07a8f6b7b9735af6b3871356efb34728942753023a8421e700c9ae70904b115d
Contents?: true
Size: 1.51 KB
Versions: 6
Compression:
Stored size: 1.51 KB
Contents
module Adaptation #= Adaptation::Adaptor -- The message processor # #Adaptation::Adaptor is the base class for those classes containing the logic to be executed when a message is read through the mom. # #Each class extending Adaptation::Adaptor must implement the _process_ function, using it as the main entry point for the logic to be executed when a message arrives. The name of the class extending Adaptation::Message associates the class with the one to be executed when a message arrives. Ie. if a message is received with a root element named _<hello>_, adaptation will search for a class extending Adaptation::Adaptor named _HelloAdaptor_. # #<i>Adaptation::Adaptors</i> (classes extending Adaptation::Adaptor) must be stored under <i>app/adaptors_name</i> in the adaptation file tree. This is done automatically when an adaptor is generated using adaptation built-in generator: # script/generate adaptor hello # class Adaptor def publish *options message_object = nil if options.first.is_a?(Message) message_object = options.first elsif options.first.is_a?(String) xml_message = options.first message_type = xml_message[1..(xml_message.index(/(>| )/) - 1)] message_class = get_class_object(message_type.capitalize) message_object = message_class.to_object(xml_message) end xml = message_object.to_xml unless system("oappublish '#{$config["application"]}' '#{xml}'") puts "Problem publishing: #{xml}" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems