Class: RabbitmqClient::PlainLogSubscriber

Inherits:
LogSubscriberBase
  • Object
show all
Defined in:
lib/rabbitmq_client/plain_log_subscriber.rb

Overview

Manage RabbitmqClient plain text logs

Instance Method Summary collapse

Methods inherited from LogSubscriberBase

logger, #logger

Instance Method Details

#confirming_message(event) ⇒ Object



43
44
45
46
47
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 43

def confirming_message(event)
  msg = 'Start>> confirming a message ' \
        "(message_id: #{event.payload.fetch(:message_id, 'undefined')})"
  debug(msg)
end

#created_exhange(event) ⇒ Object



60
61
62
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 60

def created_exhange(event)
  debug("The #{event.payload.fetch(:name)} exchange is created successfuly")
end

#exhange_not_found(event) ⇒ Object



56
57
58
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 56

def exhange_not_found(event)
  error("The Exchange '#{event.payload.fetch(:name)}' cannot be found")
end

#message_confirmed(event) ⇒ Object



49
50
51
52
53
54
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 49

def message_confirmed(event)
  msg_id = event.payload.fetch(:message_id, 'undefined')
  msg = '<<DONE confirmed a message ' \
        "(message_id: #{msg_id}) Successfuly"
  debug(msg)
end

#network_error(event) ⇒ Object



14
15
16
17
18
19
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 14

def network_error(event)
  payload = event.payload
  msg = "Failed to publish a message (#{payload.fetch(:error).message}) " \
        "to exchange (#{payload.dig(:options, :exchange_name)})"
  error(msg)
end

#overriding_configs(event) ⇒ Object



21
22
23
24
25
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 21

def overriding_configs(event)
  msg = 'Overriding the follwing configs for ' \
        "the created publisher #{event.payload.inspect}"
  debug(msg)
end

#published_message(event) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 35

def published_message(event)
  payload = event.payload
  msg = '<<DONE Published a message to ' \
       "the exchange (#{payload.fetch(:exchange, 'undefined')}) " \
       "with message_id: #{payload.fetch(:message_id, 'undefined')}"
  info(msg)
end

#publisher_created(event) ⇒ Object



8
9
10
11
12
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 8

def publisher_created(event)
  msg = 'The RabbitmqClient publisher is created ' \
        "with the follwong configs #{event.payload.inspect}"
  debug(msg)
end

#publishing_message(event) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/rabbitmq_client/plain_log_subscriber.rb', line 27

def publishing_message(event)
  payload = event.payload
  msg = 'Start>> Publishing a new message ' \
        "(message_id: #{payload.fetch(:message_id, 'undefined')} ) " \
        "to the exchange (#{payload.fetch(:exchange, 'undefined')})"
  debug(msg)
end