Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 07 14:48
    dgonzalezvts commented #177
  • Jul 23 15:11
    doits commented #190
  • Jul 23 14:31
    krisleech commented #190
  • Jul 23 14:27
    krisleech commented #189
  • Jul 23 14:09
    doits edited #192
  • Jul 23 14:08
    doits synchronize #192
  • Jul 23 14:05
    doits synchronize #192
  • Jul 23 12:22
    doits synchronize #192
  • Jul 23 12:14
    doits commented #190
  • Jul 23 12:13
    doits commented #191
  • Jul 23 12:11
    doits commented #192
  • Jul 23 12:11
    doits edited #192
  • Jul 23 12:11
    doits edited #192
  • Jul 23 12:10
    doits synchronize #192
  • Jul 23 12:09
    doits edited #192
  • Jul 23 12:05
    doits synchronize #192
  • Jul 23 12:04
    doits synchronize #192
  • Jul 23 11:56
    doits edited #192
  • Jul 23 11:54
    doits ready_for_review #192
  • Jul 23 11:54
    doits synchronize #192
Kris Leech
@krisleech
hello, world
Yan Pritzker
@skwp
intersting
This message was deleted
Jeff Dickey
@jdickey
Hi, Kris. Yeah, it is interesting; it beats the stufing out of IM or IRC chats. Was going to ask a question about Wisper before I found Issue #75; the comment there was inadvertent (intended for my own tracking issue), but the sentiment still stands.
Kris Leech
@krisleech
@jdickey Hi :) I commented on the issue.
I'm also watching new_poc with interest.
Jeff Dickey
@jdickey
thanks! It's evolved quite a bit over its Bataanesque progress, but I think it's on the best approximation yet of "a right track" :P
Ryan Platte
@replaid
This message was deleted
Ryan Platte
@replaid
I'm using wisper-activerecord and have decided to ship semantic events for all situations relevant to listeners. So wisper-activerecord 0.3.0 sends out a :<model_name>_committed event that I want to transform into a :<model_name>_captured when #captured? goes from false to true. Since this is knowledge about the AR itself it seems a bit over the top to set up a separate listener just for this purpose, so I'm wanting to subscribe an AR to itself and ship the new event directly from a#<model_name>_committed method on the AR.
To do this was a after_initialize {|my_ar| my_ar.subscribe(my_ar) }, then a def <model_name>_committed(my_ar) that broadcasts the new event when appropriate. I'm either sharing an interesting usage of Wisper or soliciting feedback depending on whether folks here think this idea is sound or not. :-)
Kris Leech
@krisleech
@replaid thanks for sharing! Why not after_save { |thing| broadcast(:thing_captured, thing) if thing_captured_changed? }.
Ryan Platte
@replaid
That's clearer and leaner, thanks. (it will need to be an after_commit but that's beside the point)
Yan Pritzker
@skwp
I found a very interesting issue if you "return" out of an "on" block causing the wisper loop to terminate early as the return causes the calling context to exit. I have a blog post coming out soon on this topic. If anyone is interested in more details please let me know.
Kris Leech
@krisleech
@skwp does having the return mean some events are never sent? Happy to wait for the blog post if it does explain well here :)
If anyone is interested I started a repo for relaying Wisper events to RabbitMQ (just a README so far). https://github.com/krisleech/wisper-rabbitmq
Yan Pritzker
@skwp
@krisleech yep if you return out of your 'on' block some of your listeners like global listeners may not be triggered. our blog is on a weekly schedule so I was going to roll it out on friday but I'll invite you to look at the post ahead of time since this is your baby :)
Jeff Dickey
@jdickey
@skwp Good catch!
Kris Leech
@krisleech
@skwp :thumbsup:
Kris Leech
@krisleech
Relaying Wisper events to MessageBus https://github.com/krisleech/wisper-message_bus
Jeff Dickey
@jdickey
@krisleech good stuff; potentially quite useful!
Rafael George
@cored
hi
it is possible to have a listern that also act as publisher?
doesn't look like this is possible if I want to have the listener to be async since I'm using wisper-sidekiq and the gem expects a class instead of an objet
Kris Leech
@krisleech
@cored sorry, only just saw this message. I'm not sure I have tried, but you should be able to have an object be both listener and publisher. Do you have some code you can share?
Rafael George
@cored
@krisleech oh no, sorry at least not at the moment
Kris Leech
@krisleech
@cored no worries, if you have any further issues, it might be best to open a stackoverflow issue :)
Rafael George
@cored
sure thing
I'll do that. I was about to not use wisper directl since I wwanted to give dry-transaction a try
however I don't see an easy way to test the triggering of events from a dry-transaction object; I tried with wisper-rspc since they use wisper under the hood but I gave up at some point and probably back to wisper again
Kris Leech
@krisleech
I think wisper-rspec will only work for dry-transaction if you can get the actual publisher. It might not an object you own. Not sure...
Rafael George
@cored
interesting
I tried with just tryigering the dry-transaction defined method and then in the block assert whatever I needed
Kris Leech
@krisleech
The other thing to be careful of is dry-trans removing wisper as a dependency :)
Rafael George
@cored
right
make sense, yes probably not a good approach to try to test directly the internals
maybe I should just subscribe to the event I want to assert on the result
Kris Leech
@krisleech
using just wisper or dry-trans?
Rafael George
@cored
I can test like that with both
Kris Leech
@krisleech
so, subscribe in the test and then test the result?
Rafael George
@cored
but it would be with dry-transaction; I tested in the past with wisper-rspec just asserting on triggering the actual event that I wanted
yeap
my service objects normally don't mutate state on whatever you past into it so I return something that I call a view model which is a transformation that represents the side effect, I use wisper to publish taht side effect to the rest of the system so I avoid the coupling between service objects\
since my service objects return the transformation I just have to assert on those values on the subscribed block
Kris Leech
@krisleech
It records all events and payloads. You could do this.
I have to go and get lunch now, bbl
Rafael George
@cored
enjoy
and thanks for the hint
Kris Leech
@krisleech
no problem