Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to start on fresh installation #24

Closed
timwis opened this issue Apr 5, 2019 · 6 comments
Closed

Fails to start on fresh installation #24

timwis opened this issue Apr 5, 2019 · 6 comments

Comments

@timwis
Copy link
Contributor

timwis commented Apr 5, 2019

Hello, I'm new to elixir but learning quickly. I followed the installation instructions to the letter, but I can't start my application once I append {DataDigestQueue.Broker, []} to the children list in lib/data_digest/application.ex.

The error message when I run mix phx.server is:

** (Mix) Could not start application data_digest: DataDigest.Application.start(:normal, []) returned an error: shutdown: failed to start child: DataDigestQueue.Broker
    ** (EXIT) shutdown: failed to start child: ConduitAMQP
        ** (EXIT) an exception was raised:
            ** (UndefinedFunctionError) function ConduitAMQP.start_link/1 is undefined or private
                (conduit_amqp) ConduitAMQP.start_link([DataDigestQueue.Broker, [{:queue, "data_digest.jobs", []}], %{jobs: [from: "data_digest.jobs"]}, [adapter: ConduitAMQP, url: "amqp://guest:guest@localhost:5672"]])
                (stdlib) supervisor.erl:379: :supervisor.do_start_child_i/3
                (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
                (stdlib) supervisor.erl:349: anonymous fn/3 in :supervisor.start_children/2
                (stdlib) supervisor.erl:1157: :supervisor.children_map/4
                (stdlib) supervisor.erl:315: :supervisor.init_children/2
                (stdlib) gen_server.erl:374: :gen_server.init_it/2
                (stdlib) gen_server.erl:342: :gen_server.init_it/6
                (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

That suggests to me that Conduit.Broker is trying to start ConduitAMQP with the wrong number of arguments (1 keyword list instead of it spread out among 4 arguments). I can see where this is likely happening in the library, but am surprised that I don't see any other reports of this issue so I assume it's user error after all.

In the meantime, I'm able to get it work by modifying deps/conduit_amqp/lib/conduit_amqp.ex to add:

  def start_link([broker, topology, subscribers, opts]) do
    start_link(broker, topology, subscribers, opts)
  end
@blatyo
Copy link
Member

blatyo commented Apr 5, 2019

What version of Elixir, conduit, and conduit_amqp are you using?
Can you share your application.ex start function?

https://github.com/conduitframework/conduit/blob/95c67209aa/lib/conduit/broker.ex#L83

This get's passed to child_spec/2 on the adapter module, not directly to start_link.

https://github.com/conduitframework/conduit_amqp/blob/master/lib/conduit_amqp.ex#L31-L37

The list of arguments here, are individual arguments. So a list of 4, is equivalent to four arguments.

@timwis
Copy link
Contributor Author

timwis commented Apr 5, 2019

I'm on elixir v1.8.1, conduit ~> 0.12, conduit_amqp ~> 0.4.

  def start(_type, _args) do
    # List all child processes to be supervised
    children = [
      # Start the Ecto repository
      DataDigest.Repo,
      # Start the endpoint when the application starts
      DataDigestWeb.Endpoint,
      # Starts a worker by calling: DataDigest.Worker.start_link(arg)
      # {DataDigest.Worker, arg},
      {DataDigestQueue.Broker, []}
    ]

    # See https://hexdocs.pm/elixir/Supervisor.html
    # for other strategies and supported options
    opts = [strategy: :one_for_one, name: DataDigest.Supervisor]
    Supervisor.start_link(children, opts)
  end

@blatyo
Copy link
Member

blatyo commented Apr 5, 2019

Can you provide the specific versions your using: mix deps

@blatyo
Copy link
Member

blatyo commented Apr 5, 2019

I suspect the version of conduit and conduit_amqp you're using are not compatible with each other. Newest version of conduit is 0.12.10 and newest of conduit_amqp is 0.6.3. If something said you should use ~> 0.4, that should get updated.

@blatyo
Copy link
Member

blatyo commented Apr 5, 2019

Also, worth noting that there is an example app you can compare against: https://github.com/conduitframework/conduit_amqp_example

@timwis
Copy link
Contributor Author

timwis commented Apr 5, 2019

Sure, mix.deps says conduit 0.12.10 and conduit_amqp 0.4.6. I was following the generator output. Upgrading to 0.6.3 has fixed it. Thanks! (And yes I went through the example before reporting the issue, thanks though)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants