Giter Club home page Giter Club logo

Comments (1)

Relrin avatar Relrin commented on August 15, 2024

Okay, I figured out what the issue was here:

  1. You need to provide a used channel to a GenServer state in init/1, so that it will possible to re-use it. Otherwise create it manually when it have a available connection to AMQP. For example, it can be looks like this:
def init(opts) do
    Process.flag(:trap_exit, true)

    # Some default setting for a connection
    config = @defaults
        |> Keyword.merge(opts)
        |> Confex.Resolver.resolve!

    {:ok, connection} = open_connection(opts)  # Create a new connection for AMQP here
    Process.monitor(connection.pid)            

    # Let to a developer to do stuff here and use the result of it later
    # For example, it could be a couple of channels for you purposes
    {:ok, meta} = configure(connection, config)  
    {:ok, [connection: connection, config: config, meta: meta]}
end
  1. After it describe the handlers for your own cases and reuse the data from a state.

from amqp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.