Class: ActiveMessaging::Adapters::BaseConnection

Inherits:
Object
  • Object
show all
Includes:
ActiveMessaging::Adapter
Defined in:
lib/activemessaging/adapters/base.rb

Overview

use this as a base for implementing new connections

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActiveMessaging::Adapter

included, #logger

Constructor Details

#initialize(cfg) ⇒ BaseConnection

generic init method needed by a13g



18
19
# File 'lib/activemessaging/adapters/base.rb', line 18

def initialize cfg
end

Instance Attribute Details

#reliableObject

configurable params



15
16
17
# File 'lib/activemessaging/adapters/base.rb', line 15

def reliable
  @reliable
end

Instance Method Details

#disconnectObject

called to cleanly get rid of connection



22
23
# File 'lib/activemessaging/adapters/base.rb', line 22

def disconnect
end

#receive(options = {}) ⇒ Object

receive a single message from any of the subscribed destinations check each destination once, then sleep for poll_interval adding options,optionally, so a poller can get certain messages (e.g. by priority)



43
44
# File 'lib/activemessaging/adapters/base.rb', line 43

def receive(options={})
end

#received(message, headers = {}) ⇒ Object

called after a message is successfully received and processed



47
48
# File 'lib/activemessaging/adapters/base.rb', line 47

def received message, headers={}
end

#send(destination_name, message_body, message_headers = {}) ⇒ Object

destination_name string, body string, headers hash send a single message to a destination



37
38
# File 'lib/activemessaging/adapters/base.rb', line 37

def send destination_name, message_body, message_headers={}
end

#subscribe(destination_name, message_headers = {}) ⇒ Object

destination_name string, headers hash subscribe to listen on a destination



27
28
# File 'lib/activemessaging/adapters/base.rb', line 27

def subscribe destination_name, message_headers={}
end

#unreceive(message, headers = {}) ⇒ Object

called after a message is successfully received but unsuccessfully processed purpose is to return the message to the destination so receiving and processing and be attempted again



52
53
# File 'lib/activemessaging/adapters/base.rb', line 52

def unreceive message, headers={}
end

#unsubscribe(destination_name, message_headers = {}) ⇒ Object

destination_name string, headers hash unsubscribe to listen on a destination



32
33
# File 'lib/activemessaging/adapters/base.rb', line 32

def unsubscribe destination_name, message_headers={}
end