Class: Hivehook::Resources::DLQService

Inherits:
BaseService show all
Defined in:
lib/hivehook/resources/dlq_service.rb

Constant Summary collapse

FRAGMENT =
"id deliveryId eventId lastError replayedAt createdAt"

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Hivehook::Resources::BaseService

Instance Method Details

#get(id) ⇒ Object



18
19
20
21
# File 'lib/hivehook/resources/dlq_service.rb', line 18

def get(id)
  query = "query($id: UUID!) { dlqEntry(id: $id) { #{FRAGMENT} } }"
  @transport.execute(query, { "id" => id })["dlqEntry"]
end

#list(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/hivehook/resources/dlq_service.rb', line 8

def list(options = {})
  query = "query($eventId: UUID, $replayed: Boolean, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
    dlqEntries(eventId: $eventId, replayed: $replayed, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
      nodes { #{FRAGMENT} }
      pageInfo { total limit offset endCursor hasNextPage }
    }
  }"
  @transport.execute(query, build_variables(options, %w[eventId replayed search limit offset after first]))["dlqEntries"]
end

#purge(older_than) ⇒ Object



33
34
35
36
# File 'lib/hivehook/resources/dlq_service.rb', line 33

def purge(older_than)
  query = "mutation($olderThan: String!) { purgeDLQ(olderThan: $olderThan) { purged } }"
  @transport.execute(query, { "olderThan" => older_than })["purgeDLQ"]
end

#replay(id) ⇒ Object



23
24
25
26
# File 'lib/hivehook/resources/dlq_service.rb', line 23

def replay(id)
  query = "mutation($id: UUID!) { replayDLQEntry(id: $id) }"
  @transport.execute(query, { "id" => id })["replayDLQEntry"]
end

#replay_allObject



28
29
30
31
# File 'lib/hivehook/resources/dlq_service.rb', line 28

def replay_all
  query = "mutation { replayAllDLQ { deliveries } }"
  @transport.execute(query)["replayAllDLQ"]
end