{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka/issues/18032","labels_url":"https://api.github.com/repos/akka/akka/issues/18032/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/18032/comments","events_url":"https://api.github.com/repos/akka/akka/issues/18032/events","html_url":"https://github.com/akka/akka/issues/18032","id":95808214,"number":18032,"title":"Hook on PersistentActor after message is persisted","user":{"login":"jgordijn","id":210142,"avatar_url":"https://avatars.githubusercontent.com/u/210142?v=3","gravatar_id":"","url":"https://api.github.com/users/jgordijn","html_url":"https://github.com/jgordijn","followers_url":"https://api.github.com/users/jgordijn/followers","following_url":"https://api.github.com/users/jgordijn/following{/other_user}","gists_url":"https://api.github.com/users/jgordijn/gists{/gist_id}","starred_url":"https://api.github.com/users/jgordijn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgordijn/subscriptions","organizations_url":"https://api.github.com/users/jgordijn/orgs","repos_url":"https://api.github.com/users/jgordijn/repos","events_url":"https://api.github.com/users/jgordijn/events{/privacy}","received_events_url":"https://api.github.com/users/jgordijn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/akka/akka/labels/3%20-%20in%20progress","name":"3 - in progress","color":"eb6420"},{"url":"https://api.github.com/repos/akka/akka/labels/community-contrib","name":"community-contrib","color":"009800"},{"url":"https://api.github.com/repos/akka/akka/labels/t:persistence","name":"t:persistence","color":"CCCCCC"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/akka/akka/milestones/51","html_url":"https://github.com/akka/akka/milestones/2.4-M3","labels_url":"https://api.github.com/repos/akka/akka/milestones/51/labels","id":1182286,"number":51,"title":"2.4-M3","description":"","creator":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"open_issues":66,"closed_issues":37,"state":"open","created_at":"2015-06-26T09:02:24Z","updated_at":"2015-08-07T10:08:31Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-07-18T09:31:01Z","updated_at":"2015-08-07T10:08:31Z","closed_at":"2015-08-07T10:08:31Z","body":"I want to extend the behaviour of the `PersistentActor` such that a function is called (with the persisted event) every time a message is persisted. If the `PersistentActor` provided a hook `onPersistSuccess` it would be possible to extend the behaviour.\r\n\r\nThe use case is that I want to publish every persisted message on a bus. I would like to mixin a trait into the existing actors to provide this behaviour, but that means that the existing Actor needs to call a new function `persistAndPublish` instead of `persist`. I would like to use this hook so that mixing in this trait is enough.\r\n"},"comment":{"url":"https://api.github.com/repos/akka/akka/issues/comments/128662907","html_url":"https://github.com/akka/akka/issues/18032#issuecomment-128662907","issue_url":"https://api.github.com/repos/akka/akka/issues/18032","id":128662907,"user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T10:08:31Z","updated_at":"2015-08-07T10:08:31Z","body":"We have been discussing and thinking about this several times, but in the end we don't think it is worth expanding the api surface for this. Adding hooks for cross cutting concerns at all places is not feasible. I'm sure  many similar hooks are needed in other places in akka if we go that route."}}