Class: Insika::ChannelRegistry

Inherits:
Registry
  • Object
show all
Defined in:
lib/insika/channel_registry.rb

Overview

The channels this deployment speaks, by id. A Registry like tools and workflows — same plugin bookkeeping, so deregister_plugin rolls a half-registered plugin back exactly as it does for a tool.

The id is the URL segment (/channels/relay/events), which is why lookup here is a find and not a resolve: an unknown segment is a 404, not an exception the transport has to rescue.

Instance Method Summary collapse

Methods inherited from Registry

#deregister_plugin, #entries, #entry, #initialize, #names, #register, #resolve

Constructor Details

This class inherits a constructor from Insika::Registry

Instance Method Details

#deliverable?(id) ⇒ Boolean

Does this channel deliver out of band (Shape B)? A Shape A channel answers on the request's own stream and has no deliver, so nothing is ever written to the outbox for it. Duck-typed, like every other seam in the engine.

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/insika/channel_registry.rb', line 25

def deliverable?(id)
  channel = find(id)
  !channel.nil? && channel.respond_to?(:deliver)
end

#find(id) ⇒ Object

-> the channel instance | nil (unknown id). A blank id never matches.



13
14
15
16
17
18
19
20
# File 'lib/insika/channel_registry.rb', line 13

def find(id)
  name = id.to_s
  return nil if name.empty?

  resolve(name)
rescue Insika::NotFoundError
  nil
end