tfs addWorkItemSaveListener没有获取事件

时间:2012-11-01 14:06:19

标签: sdk tfs

我正在添加一个TFS WorkItemSaveListener,但没有在保存工作项时获得任何事件。

public static void main(String[] args) {
        // Connecting to Project
        final TFSTeamProjectCollection collection = ConsoleSettings.connectToTFS();

        // Creating an object of listener
        WorkItemSaveListenerImpl listener = new WorkItemSaveListenerImpl();

        //Adding the listener
        collection.getWorkItemClient().getEventEngine().addWorkItemSaveListener(listener);

        for(;;) {
            // keeping the program alive
            try {

                Thread.sleep(10000);
            }
            catch (InterruptedException exception) {
                // TODO Auto-generated catch block
                exception.printStackTrace();
            }
        } 


    }

1 个答案:

答案 0 :(得分:0)

我只是在这里猜测,因为我不知道java sdk。但是,是否可能仅针对特定工作项客户端更改的工作项触发addWorkItemSaveListener事件?

您可能需要设置soap订阅,或者编写服务器插件。

C#设置肥皂订阅

很抱歉这是错误的事件,但它可能足以让你有个想法。

TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(txtServerUrl.Text));
tpc.EnsureAuthenticated();
IEventService eventSrv = tpc.GetService(typeof(IEventService)) as IEventService;
DeliveryPreference delPref = new DeliveryPreference();
delPref.Address = "http://" + System.Environment.MachineName + ":8001/CheckInNotify";
delPref.Schedule = DeliverySchedule.Immediate;
delPref.Type = DeliveryType.Soap;
subscriptionId = eventSrv.SubscribeEvent(System.Environment.UserDomainName + "\\" +     System.Environment.UserName, "CheckInNotify", "", delPref);