Sha256: c678a3d035c36df3e2f8d9638e381c8411f3a5e4b190c80f0338c64aef8829db

Contents?: true

Size: 710 Bytes

Versions: 4

Compression:

Stored size: 710 Bytes

Contents

require "uri"

module Moleculer
  ##
  # Transporters allow you to run services on multiple nodes. They provide the communication channels for other with
  # other nodes handling the transfer of events, action calls and responses, ...etc.
  module Transporters

    ##
    # Returns a new transporter for the provided transporter uri
    #
    # @param [String] uri the transporter uri
    # @param [Moleculer::Broker] broker the broker instance
    #
    # @return [Moleculer::Transporters::Base] the transporter instance
    def self.for(uri)
      parsed = URI(uri)
      require_relative("./transporters/#{parsed.scheme}")
      const_get(parsed.scheme.split("_").map(&:capitalize).join)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
moleculer-0.3.0 lib/moleculer/transporters.rb
moleculer-0.2.0 lib/moleculer/transporters.rb
moleculer-0.1.1 lib/moleculer/transporters.rb
moleculer-0.1.0 lib/moleculer/transporters.rb