开发者

How can I get notifications from my TFS server, when a work item is changed?

I am writing a simple custom work item browser and I'd like it to follow the real-time changes happening to work items on my TFS server.

For example, if someone has changed a work item's Title or State, I'd update my work it开发者_Python百科em tree with this new information.

How can I subscribe to such events?


You can use the TFS eventing mechanism to subscribe a web service endpoint to get notified when a work item changes. However this is designed for server->server communication and this push notification mechanism does not work well for client applications.

Instead I would recommend that you use the TFS .NET Api to poll the server periodically for updates. To make the poll operation efficient after you have got a full set of results using your query, you could modify the WIQL to just look for work items where the changed date is greater than the last time that you polled the server.

The reason the "pull" model works better than the "push" model in this case is as follow:

  1. To send a web service push notification to your client machine, the TFS instance needs to be able to talk directly to the port on your client box. That means that you must have the appropriate port open and allow traffic in that direction from you firewall.
  2. Push notifications need Team Foundation Server Administration level user permissions to create which means that only Administration users can use your application
  3. The server will attempt to send notifications to the subscribers until the subscriber removes the event subscription. This means that is your application crashes or doesn't clean up it's subscriptions correctly then the server will be attempting to send messages to machines that are not listening for them. This will use up resources on your TFS server and generate errors in the TFS Server event logs. Your application will need a significant amount of logic to ensure that it records which subscriptions are in place and manage them appropriately.

Hope that makes sense.


For Email Alerts

TFS Client includes a subscribe to alters for any changes to your work items ("project alerts" in the team project node's context menu in team explorer).

To subscribe to work items based other criteria (including all for a team project) the TFS Power Toys includes an alerts editor (the power toys add an alerts node under each team project in team explorer).

For Web Service Calls

These are also possible (e.g. to have a server listening): See the Visual Studio SDK for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜