Name: kane
Owner: CCP Games
Description: Google Pub/Sub client for Elixir
Forked from: peburrows/kane
Created: 2017-10-02 22:59:44.0
Updated: 2017-10-02 23:00:32.0
Pushed: 2017-10-04 00:04:42.0
Homepage: http://hexdocs.pm/kane
Size: 61
Language: Elixir
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Kane. Citizen Kane. Charles Foster Kane, to be exact, Publisher extraordinaire. Rosebud.
Kane is for publishing and subscribing to topics using Google Cloud Pub/Sub.
Add Kane to your list of dependencies in mix.exs
:
deps do
ane, "~> 0.2.0"}]
Configure Goth (Kane's underlying token storage and retrieval library) with your Google JSON credentials:
ig :goth,
: "path/to/google/json/creds.json" |> File.read!
Ensure Kane is started before your application:
application do
lications: [:kane]]
Pull, process and acknowledge messages via a pre-existing subscription:
cription = %Kane.Subscription{topic: %Kane.Topic{name: "my-topic"}}
, messages} = Kane.Subscription.pull(subscription)
.each messages, fn(mess)->
ocess_message(mess)
knowledge message receipt in bulk
.Subscription.ack(subscription, messages)
Send message via pre-existing subscription:
c = %Kane.Topic{name: "my-topic"}
age = %Kane.Message{data: %{"hello": "world"}, attributes: %{"random" => "attr"}}
lt = Kane.Message.publish(message, topic)
result do
ok, _return} -> IO.puts("It worked!")
error, _reason} -> IO.puts("Should we try again?")
Hints:
For more details, see the documentation.