Coder Social home page Coder Social logo

Comments (8)

medikent avatar medikent commented on August 22, 2024 2

Yes, we've had good experience with it. My team runs it in production. I assume cjab, the maintainer, is being conservative in his description of the library. Once we have batching and StreamingPull working then it will be closer to being a full-featured 1.0 release.

from kane.

jeffdeville avatar jeffdeville commented on August 22, 2024 1

To get this to work, I had to include /v1 in the kane endpoint. Here's my config:

config :goth, json: {:system, "GCP_CREDENTIALS"}
config :kane, :endpoint, "http://#{System.get_env("PUBSUB_EMULATOR_HOST")}/v1"

(For anyone curious, I collapsed my credentials.json file to 1 line, and exported it in GCP_CREDENTIALS)

from kane.

plasticine avatar plasticine commented on August 22, 2024

After digging a bit more it seems like the following is possible;

config :kane,
  token: Goth.Token,
  endpoint: "http://127.0.0.1:8085"

config :goth,
  json: nil,
  project_id: "foo"

from kane.

medikent avatar medikent commented on August 22, 2024

@jeffdeville Did you have to use valid GCP credentials in order to get this to work? If so, can you provide an explanation or example? Trying all the methods you and the author suggested brings me to Could not retrieve token invalid_grant errors from Goth.

from kane.

matehat avatar matehat commented on August 22, 2024

@medikent you don't need working credentials to talk to pubsub emulator. Here's what I did to make all of that work:

defmodule PubSub.Emulator do
  @moduledoc """
  Provide fake tokens when running with PubSub emulator
  """

  def for_scope(_) do
    {:ok, %{type: "Bearer", token: "dummy"}}
  end
  
  def detect() do
    emulator_host = System.get_env("PUBSUB_EMULATOR_HOST")

    unless is_nil(emulator_host) do
      Application.put_env(:kane, :token, PubSub.Emulator)
      Application.put_env(:kane, :endpoint, "http://#{emulator_host}/v1")

      Logger.info("Using pubsub emulator")
    end
  end
end

So I just add the line PubSub.Emulator.detect() in by Application.start/2 callback function and 1) it Just Worksℒ️ , and I get a nice little log Using pubsub emulator to confirm this is activated.

from kane.

medikent avatar medikent commented on August 22, 2024

@matehat Thanks for the update. I ended up going with Weddell to take advantage of gRPC. The gRPC API provides lower tail latency (see this ).
See Weddell. Once Batching (cjab/weddell#14) and StreamingPull (cjab/weddell#15) are added to Weddell it will support the low-latency, point-to-point messaging needs I have.

from kane.

matehat avatar matehat commented on August 22, 2024

Yeah I looked at Weddell quite a bit, but that statement worries me:

If the beta/experimental status of Weddell worries you Kane may be a better choice.

You've had good experience with it? Is it running in production?

from kane.

matehat avatar matehat commented on August 22, 2024

Awesome, thanks for the status! Will start to switch our code very soon πŸ˜ƒ

from kane.

Related Issues (12)

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.