Sha256: f143fc6c13d94535258a103ce35ddbb47de54b95d537cc1f3c0278aed51680c5

Contents?: true

Size: 1.51 KB

Versions: 21

Compression:

Stored size: 1.51 KB

Contents

module Fog
  module Google
    class Pubsub
      class Real
        # Pulls from a subscription. If option 'return_immediately' is
        # false, then this method blocks until one or more messages is
        # available or the remote server closes the connection.
        #
        # @param subscription [Subscription, #to_s] subscription instance or
        #   name of subscription to pull from
        # @param options [Hash] options to modify the pull request
        # @option options [Boolean] :return_immediately if true, method returns
        #   after API call; otherwise the connection is held open until
        #   messages are available or the remote server closes the connection
        #   (defaults to true)
        # @option options [Number] :max_messages maximum number of messages to
        #   retrieve (defaults to 10)
        # @see https://cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/pull
        def pull_subscription(subscription, options = { :return_immediately => true, :max_messages => 10 })
          pull_request = ::Google::Apis::PubsubV1::PullRequest.new(
            :return_immediately => options[:return_immediately],
            :max_messages => options[:max_messages]
          )

          @pubsub.pull_subscription(subscription, pull_request)
        end
      end

      class Mock
        def pull_subscription(_subscription, _options = { :return_immediately => true, :max_messages => 10 })
          raise Fog::Errors::MockNotImplemented
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fog-google-1.10.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.9.1 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.9.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.8.2 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.8.1 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.8.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.7.1 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.7.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.6.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.5.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.4.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.3.3 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.3.2 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.3.1 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.3.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.2.2 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.2.1 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.2.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.1.0 lib/fog/google/requests/pubsub/pull_subscription.rb
fog-google-1.0.1 lib/fog/google/requests/pubsub/pull_subscription.rb