Sha256: fb2727d330097f39241a48add3a46b059d48111444bc1fae8f49a3a562120861

Contents?: true

Size: 969 Bytes

Versions: 14

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

module PgEventstore
  module CommandHandlers
    class SubscriptionFeederCommands
      # @param config_name [Symbol]
      # @param subscription_feeder [PgEventstore::SubscriptionFeeder]
      def initialize(config_name, subscription_feeder)
        @config_name = config_name
        @subscription_feeder = subscription_feeder
      end

      # Look up commands for the given SubscriptionFeeder and execute them
      # @return [void]
      def process
        queries.find_commands(@subscription_feeder.id).each do |command|
          command.exec_cmd(@subscription_feeder)
          queries.delete(command.id)
        end
      end

      private

      # @return [PgEventstore::SubscriptionsSetCommandQueries]
      def queries
        SubscriptionsSetCommandQueries.new(connection)
      end

      # @return [PgEventstore::Connection]
      def connection
        PgEventstore.connection(@config_name)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pg_eventstore-1.5.0 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.4.0 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.3.4 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.3.3 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.3.2 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.3.1 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.3.0 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.2.0 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.1.5 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.1.4 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.1.3 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.1.2 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.1.1 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb
pg_eventstore-1.1.0 lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb