def response
opts = @a[0]
redis = opts[:redis]
doc = XML::Smart::string(@p[0].value.read)
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
doc.register_namespace 'sub', 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
name = doc.find('string(/*/p:attributes/p:info)')
id, uuid = NewInstance::create(opts,redis,name,doc)
subscriptions = []
(doc.find('/*/sub:subscriptions/sub:subscription') rescue []).each do |s|
sub = []
unless sub[0] = s.attributes['id']
sub[0] = Digest::MD5.hexdigest(Kernel::rand().to_s)
end
unless sub[1] = s.attributes['url']
raise "no url"
end
sub[2] = []
s.find('sub:topic').each do |t|
%w(event vote).each do |type|
t.find('sub:' + type).each do |e|
sub[2] << File.join(t.attributes['id'],type,e.text)
end
end
end
CPEE::Persistence::set_handler(id,opts,*sub)
end