ccpgames/kane

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

Kane

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.

Installation
  1. Add Kane to your list of dependencies in mix.exs:

    deps do
    ane, "~> 0.2.0"}]
    
    
  2. 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!
    
  3. Ensure Kane is started before your application:

    application do
    lications: [:kane]]
    
    
Usage

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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.