diff --git a/routes.go b/routes.go index 305298d..0b6abdb 100644 --- a/routes.go +++ b/routes.go @@ -157,6 +157,7 @@ func (s *Server) createPublisher(w http.ResponseWriter, r *http.Request) { func (s *Server) sendOut(eType channel.Type, sub *pubsub.PubSub) { // go ahead and create QDR to this address s.dataOut <- &channel.DataChan{ + ID: sub.GetID(), Address: sub.GetResource(), Data: &ce.Event{}, Type: eType, @@ -164,6 +165,17 @@ func (s *Server) sendOut(eType channel.Type, sub *pubsub.PubSub) { } } +func (s *Server) sendOutToDelete(eType channel.Type, sub *pubsub.PubSub) { + // go ahead and create QDR to this address + s.dataOut <- &channel.DataChan{ + ID: sub.GetID(), + Address: sub.GetResource(), + Data: &ce.Event{}, + Type: eType, + Status: channel.DELETE, + } +} + func (s *Server) getSubscriptionByID(w http.ResponseWriter, r *http.Request) { queries := mux.Vars(r) subscriptionID, ok := queries["subscriptionid"] @@ -257,6 +269,8 @@ func (s *Server) deleteAllSubscriptions(w http.ResponseWriter, r *http.Request) if size > 0 { localmetrics.UpdateSubscriptionCount(localmetrics.ACTIVE, -(size)) } + // go ahead and create QDR to this address + s.sendOutToDelete(channel.SUBSCRIBER, &pubsub.PubSub{ID: "", Resource: "delete-all-subscriptions"}) respondWithMessage(w, http.StatusOK, "deleted all subscriptions") }