Subscribe to Hystrix command for half-open event

28 views
Skip to first unread message

Sara

unread,
Dec 9, 2018, 7:44:07 PM12/9/18
to HystrixOSS
Hi 
I am new to Hystrix and just started to use it in an event driven micro-service. The micro-service actively listen to MQ and saves the messages in DB. I am thinking to use Hystrix command on top of DB operation, such that after a configuration number of db failure (like network timeout), it stops the MQ listener (on circuit Open event) and restart it on circuit Half-Open state.

In the documentation, SHORT_CIRCUITED is the only relevant event but it dose not give any information about Open and Half-Open states. 
Short the story, Is there any way to get notified at Open and Half-Open state changes? If not, is it possible to extend the source code and add this as a new feature or may be there are some limitations?

Regards,
Sara



Sara

unread,
Dec 19, 2018, 11:42:10 PM12/19/18
to HystrixOSS

For those who have the same problem, after checking the code for Hystrix Circuit Breaker library, I realised that firstly there is not any mechanism to notify Circuit state changes. Secondly, even if the events were there it wouldn't solve my issue. Because, Half-Open state is reached with the first attempt (service call) after the sleep window (when the circuit is open). while, for my case when JMS Listener is stopped there won't be any next attempt/call.

So, I should write a custom component that starts a timer/scheduler when opening the circuit and moves to half-open state automatically when the timer (sleep window) triggered. This should be independent to the next attempt.

Reply all
Reply to author
Forward
0 new messages