Questions tagged [wisper]

Wisper is a Ruby Publish-Subscribe gem with async support which aims to help decouple responsibilities.

Wisper was extracted from a Rails codebase but is not dependant on Rails.

It is commonly used as an alternative to ActiveRecord callbacks, Observers and Concerns to reduce coupling and make testing easier.

21 questions
9
votes
1 answer

reload wisper listeners automatically at every request

I have wisper listeners in the app/listeners directory. I also have the /config/initializers/wisper.rb module Wisper def self.setup configure do |config| config.broadcaster(:default, Broadcasters::LoggerBroadcaster.new(Rails.logger,…
Boti
  • 3,275
  • 1
  • 29
  • 54
6
votes
1 answer

rails-observers vs wisper gem

Are there any benefits of using wisper gem over rails-observers? They both looks quite similar at first sight, but wisper seems to be more supported by community (based on GH stars, commits and releases). Are there any significant differences…
jmarceli
  • 19,102
  • 6
  • 69
  • 67
3
votes
1 answer

Wisper and Grape return results from a POST request

I have a simple POST Grape endpoint with Wisper pub/sub in a background: module Something class Doit < Grape::API post :now do service = SomePub.new service.subscribe(SomeSub.new) service.call(params) end end end Here…
There Are Four Lights
  • 1,406
  • 3
  • 19
  • 35
3
votes
1 answer

Wisper: Subscribers not hearing broadcasts

I was recommend in an earlier question to use a gem called Wisper. I am very happy to learn about it, as it is exactly the solution I'm looking for. What I can't understand from the documentation on Wisper is how listeners register themselves. Here…
user3281384
  • 511
  • 1
  • 7
  • 17
2
votes
1 answer

Use object created inside RSpec expect block in assertion

I'm trying to write a test where I need the value created by the expected block to write the assertion. class Identification < ApplicationRecord include Wisper::Publisher after_save :publish_identification_declined private def…
TheVTM
  • 1,510
  • 13
  • 14
2
votes
1 answer

rails wisper under test

I have a project which used wisper https://github.com/krisleech/wisper to provide publisher and subscribers functionalities. The gem works perfectly under development and production modes. However, when I try to add some tests for them (rake…
FatSheep
  • 21
  • 4
1
vote
1 answer

Is it possible to integrate wisper with Ruby GraphQL?

I am looking to integrate wisper with my existing graphql api only ruby on rails project. Just wondering if there is any way to broadcast events from graphql mutations? module Mutations module Order include Wisper::Publisher class Create <…
Mehnaz Bano
  • 53
  • 1
  • 7
1
vote
1 answer

Rails Wisper skip listener callback

I use Rails Wisper gem and I want to execute listener callback (which sends email) only during specific tests (where I test email sending). In other tests I don't want to send emails even if in production my callback would send them. Is it possible…
jmarceli
  • 19,102
  • 6
  • 69
  • 67
1
vote
1 answer

Rails spring wisper listener method caching

It turns out that Spring caches my wisper listener method (I'm writing quite simple Engine). Example: app/models/myengine/my_class.rb class Myengine::MyClass include Wisper::Publisher def something # some logic publish(:after_something,…
jmarceli
  • 19,102
  • 6
  • 69
  • 67
1
vote
2 answers

Not start the queue by wisper-sidekiq

I'm trying to make a small example with wisper-sidekiq gem. The queue is created, but it does not start. Why? I will describe the steps that you are doing, I think it will be easier. I hope for your help. A. controller: class BooksController <…
1
vote
1 answer

Using wisper (pubsub library) with Devise

I'm trying to figure out how to use wisper with Devise. When a new user account is registered, I want to create some sample data for that user. So in my user model I would have: include Wisper::Publisher after_create :notify def notify …
Andy Waite
  • 10,785
  • 4
  • 33
  • 47
0
votes
1 answer

Rails wisper-sidekiq is not working for asynchronous jobs

can someone help me with this, I added wisper-sidekiq in my gemfile, and when I tried to broadcast event with async: true it is failing with error Psych::DisallowedClass: Tried to load unspecified class: Listener::Studentlistener whereas if I set…
0
votes
0 answers

Wisper: NoMethodError despite event definition

We're using Wisper and somehow one of our event is not registered. Here's our setup: # event is defined # class SomeListener < BaseListener # A working event listen_to :bar_updated do |id| ... end # A buggy event listen_to…
Sumak
  • 927
  • 7
  • 21
0
votes
0 answers

ActiveRecordNotFound on wisper publish

We have a model ChatRoom which has many messages, the ChatRoom implements add_message and receives the parameters for the message along with a boolean notify which specifies whether we should send an email or not for the created message. We publish…
0
votes
1 answer

How can I catch the response on request and then execute something?

I have an application in which I have the END-point where the request is sent by another service to collect requests from my application to this service. This service then executes requests and sends me responses to another END-point. And suppose I…
1
2