Sha256: 02df33ad9fafd325b019e571206e8fd28ce93666ecdd2dd2a171b49aa8ebc97d

Contents?: true

Size: 1.96 KB

Versions: 95

Compression:

Stored size: 1.96 KB

Contents

# frozen_string_literal: true

require_dependency "renalware"

# New subscription registry - previous implementation does not work across threads.
# Each key in the map (hash) is the name of a class that broadacasts/publishes messages.
# Entries in the array (value) for that key are classes which subscribe to events in the
# publishing class. If you want a subscriber to listen asynchronously for events via ActiveJob,
# use an Subscriber instance like so
# "Renalware::Modalities::ChangePatientModality" => [
#   Renalware::Broadcasting::Subscriber.new("Renalware::Patients::DummyListener", async: true),
#   ...
# ]
# TODO: Ideally we would like an API something like this:
#   Renalware.configure do |config|
#     config.broadcast_subscription_map.configure do |publishers|
#       publishers[Renalware::Modalities::ChangePatientModality] do |publisher|
#         publisher.add_subscriber(Renalware::X)
#         publisher.add_subscriber(Renalware::y, async: true)
#       end
#     end
#   end
# As it stands its a bit too easy for the exposed subscription map hash to be overwritten by a host
# application with confusing and outcomes.
Renalware.configure do |config|
  config.broadcast_subscription_map = {
    "Renalware::Modalities::ChangePatientModality" => [
      "Renalware::Medications::PatientListener",
      "Renalware::Letters::PatientListener",
      "Renalware::HD::PatientListener",
      "Renalware::Patients::PatientListener"
    ],
    "Renalware::Letters::ApproveLetter" => [
      Renalware::Broadcasting::Subscriber.new(
        "Renalware::Letters::CalculatePageCountJob",
        async: true
      )
    ],
    "Renalware::Letters::ResolveDefaultElectronicCCs" => [
      "Renalware::HD::PatientListener"
    ],
    "Renalware::Pathology::CreateObservationRequests" => [],
    "Renalware::Events::CreateEvent" => [],
    "Renalware::Events::UpdateEvent" => []
  }
end

Renalware::Patients.configure
Renalware::Pathology.configure
Renalware::PD.configure do |config|
  # ...
end

Version data entries

95 entries across 95 versions & 1 rubygems

Version Path
renalware-core-2.1.1 config/initializers/renalware.rb
renalware-core-2.1.0 config/initializers/renalware.rb
renalware-core-2.0.167 config/initializers/renalware.rb
renalware-core-2.0.166 config/initializers/renalware.rb
renalware-core-2.0.165 config/initializers/renalware.rb
renalware-core-2.0.164 config/initializers/renalware.rb
renalware-core-2.0.163 config/initializers/renalware.rb
renalware-core-2.0.162 config/initializers/renalware.rb
renalware-core-2.0.161 config/initializers/renalware.rb
renalware-core-2.0.160 config/initializers/renalware.rb
renalware-core-2.0.159 config/initializers/renalware.rb
renalware-core-2.0.158 config/initializers/renalware.rb
renalware-core-2.0.157 config/initializers/renalware.rb
renalware-core-2.0.156 config/initializers/renalware.rb
renalware-core-2.0.155 config/initializers/renalware.rb
renalware-core-2.0.153 config/initializers/renalware.rb
renalware-core-2.0.152 config/initializers/renalware.rb
renalware-core-2.0.151 config/initializers/renalware.rb
renalware-core-2.0.149 config/initializers/renalware.rb
renalware-core-2.0.148 config/initializers/renalware.rb