{"action":"opened","issue":{"url":"https://api.github.com/repos/mixpanel/mixpanel-php/issues/21","labels_url":"https://api.github.com/repos/mixpanel/mixpanel-php/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/mixpanel/mixpanel-php/issues/21/comments","events_url":"https://api.github.com/repos/mixpanel/mixpanel-php/issues/21/events","html_url":"https://github.com/mixpanel/mixpanel-php/issues/21","id":61058442,"number":21,"title":"Support custom instantiation for custom message consumers","user":{"login":"felixdv","id":26912,"avatar_url":"https://avatars.githubusercontent.com/u/26912?v=3","gravatar_id":"","url":"https://api.github.com/users/felixdv","html_url":"https://github.com/felixdv","followers_url":"https://api.github.com/users/felixdv/followers","following_url":"https://api.github.com/users/felixdv/following{/other_user}","gists_url":"https://api.github.com/users/felixdv/gists{/gist_id}","starred_url":"https://api.github.com/users/felixdv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixdv/subscriptions","organizations_url":"https://api.github.com/users/felixdv/orgs","repos_url":"https://api.github.com/users/felixdv/repos","events_url":"https://api.github.com/users/felixdv/events{/privacy}","received_events_url":"https://api.github.com/users/felixdv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-13T12:56:17Z","updated_at":"2015-03-13T12:56:17Z","closed_at":null,"body":"Right now, I've written my own message consumer which pushes events to a Redis queue. In order to do that, I'd like to be able to supply the Redis client dependency through constructor injection, but since I can only provide the class string for my message consumer, this isn't possible. Something like this would be nice:\r\n\r\n```php\r\n\r\n$customConsumer = new My\\Project\\CustomConsumer($options, $redisClient);\r\n\r\n$mp = new Mixpanel(\"MIXPANEL_PROJECT_TOKEN\", array(\r\n    \"debug\"             => true,\r\n    \"max_batch_size\"    => 1,\r\n    \"consumers\"         => array(\"ob\" => $customConsumer),\r\n    \"consumer\"          => \"ob\"\r\n));\r\n```\r\n\r\nIf there is a better way of dealing with custom consumer dependencies, I'd love to know!"}}