{"action":"created","issue":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/4276","repository_url":"https://api.github.com/repos/Particular/NServiceBus","labels_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4276/labels{/name}","comments_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4276/comments","events_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4276/events","html_url":"https://github.com/Particular/NServiceBus/issues/4276","id":187605264,"number":4276,"title":"Make ScheduledTask public","user":{"login":"SimonCropp","id":122666,"avatar_url":"https://avatars.githubusercontent.com/u/122666?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonCropp","html_url":"https://github.com/SimonCropp","followers_url":"https://api.github.com/users/SimonCropp/followers","following_url":"https://api.github.com/users/SimonCropp/following{/other_user}","gists_url":"https://api.github.com/users/SimonCropp/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonCropp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonCropp/subscriptions","organizations_url":"https://api.github.com/users/SimonCropp/orgs","repos_url":"https://api.github.com/users/SimonCropp/repos","events_url":"https://api.github.com/users/SimonCropp/events{/privacy}","received_events_url":"https://api.github.com/users/SimonCropp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/Particular/NServiceBus/milestones/147","html_url":"https://github.com/Particular/NServiceBus/milestones/6.1.0","labels_url":"https://api.github.com/repos/Particular/NServiceBus/milestones/147/labels","id":2032004,"number":147,"title":"6.1.0","description":"","creator":{"login":"andreasohlund","id":125028,"avatar_url":"https://avatars.githubusercontent.com/u/125028?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasohlund","html_url":"https://github.com/andreasohlund","followers_url":"https://api.github.com/users/andreasohlund/followers","following_url":"https://api.github.com/users/andreasohlund/following{/other_user}","gists_url":"https://api.github.com/users/andreasohlund/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasohlund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasohlund/subscriptions","organizations_url":"https://api.github.com/users/andreasohlund/orgs","repos_url":"https://api.github.com/users/andreasohlund/repos","events_url":"https://api.github.com/users/andreasohlund/events{/privacy}","received_events_url":"https://api.github.com/users/andreasohlund/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":27,"state":"open","created_at":"2016-09-27T14:45:47Z","updated_at":"2016-11-07T23:00:19Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2016-11-07T01:05:57Z","updated_at":"2016-11-08T08:01:57Z","closed_at":null,"body":"not all serializers can handle the current format of `ScheduledTask`. For example the fact that it is internal.\r\n\r\nSo serializers have to do stuff like this \r\n\r\n```\r\n\r\n    static class ScheduledTaskHelper\r\n    {\r\n        static Type scheduledTaskType = typeof(IMessage).Assembly.GetType(\"NServiceBus.ScheduledTask\");\r\n        static PropertyInfo taskProperty;\r\n        static PropertyInfo nameProperty;\r\n        static PropertyInfo everyProperty;\r\n        static ConstructorInfo constructor;\r\n        public static Type WrapperType = typeof(ScheduledTaskWrapper);\r\n\r\n        static ScheduledTaskHelper()\r\n        {\r\n            constructor = scheduledTaskType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, null, Type.EmptyTypes, null);\r\n            taskProperty = scheduledTaskType.GetProperty(\"TaskId\");\r\n            nameProperty = scheduledTaskType.GetProperty(\"Name\");\r\n            everyProperty = scheduledTaskType.GetProperty(\"Every\");\r\n        }\r\n\r\n        public static bool IsScheduleTask(this Type messageType)\r\n        {\r\n            return messageType == scheduledTaskType;\r\n        }\r\n\r\n        public static ScheduledTaskWrapper ToWrapper(object target)\r\n        {\r\n            var taskId = (Guid) taskProperty.GetValue(target, null);\r\n            var name = (string) nameProperty.GetValue(target, null);\r\n            var timeSpan = (TimeSpan) everyProperty.GetValue(target, null);\r\n            return new ScheduledTaskWrapper\r\n            {\r\n                TaskId = taskId.ToString(\"D\"),\r\n                Name = name,\r\n                Ticks = timeSpan.Ticks,\r\n            };\r\n        }\r\n\r\n        public static object FromWrapper(ScheduledTaskWrapper target)\r\n        {\r\n            var instance = constructor.Invoke(null);\r\n            taskProperty.SetValue(instance, Guid.ParseExact(target.TaskId, \"D\"));\r\n            nameProperty.SetValue(instance, target.Name);\r\n            everyProperty.SetValue(instance, TimeSpan.FromTicks(target.Ticks));\r\n            return instance;\r\n        }\r\n\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/comments/259070603","html_url":"https://github.com/Particular/NServiceBus/issues/4276#issuecomment-259070603","issue_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4276","id":259070603,"user":{"login":"andreasohlund","id":125028,"avatar_url":"https://avatars.githubusercontent.com/u/125028?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasohlund","html_url":"https://github.com/andreasohlund","followers_url":"https://api.github.com/users/andreasohlund/followers","following_url":"https://api.github.com/users/andreasohlund/following{/other_user}","gists_url":"https://api.github.com/users/andreasohlund/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasohlund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasohlund/subscriptions","organizations_url":"https://api.github.com/users/andreasohlund/orgs","repos_url":"https://api.github.com/users/andreasohlund/repos","events_url":"https://api.github.com/users/andreasohlund/events{/privacy}","received_events_url":"https://api.github.com/users/andreasohlund/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T08:01:57Z","updated_at":"2016-11-08T08:01:57Z","body":">that also sounds like something we would do in a major version?\r\n\r\nAgreed, let's make it public now and raise an issue to move the scheduler out?\r\n\r\n@mauroservienti I remember that you had some ideas for a external scheduler?"}}
{"actor":{"display_login":"andreasohlund"}}