I came across this link that shows how to do this using TFS .Net SDK.
TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(txtTfsURL.Text), new UICredentialsProvider());
tpc.EnsureAuthenticated();
IEventService eventService = 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 = eventService.SubscribeEvent(System.Environment.UserDomainName + “\\” + System.Environment.UserName, “CheckInEvent”, “”, delPref);
lblSubscription.Content = string.Format("A checkin subscription is created with subscription id : {0}",subscriptionId.ToString());
What are corresponding Java APIs? Are they the same as below?
TFSTeamProjectCollection.getVersionControlClient().getEventEngine().addCheckinListener(CheckinListener listener);
Also I suspect this listener is notified only when we checkin using the same client. Is that correct?
There is a GUID which is guid of collection but it is part of someother data so not sure if its available all the time and projectname. Any ideas?
No, the two examples you provide are not equivalent. The first example sets up a SOAP notification and Team Foundation Server will send a SOAP message to the configured endpoint whenever any user checks in. The second will configure the client's event "engine" to call your checkin listener whenever your client successfully checks in.
The Java API, as you note, will configure the Java API to trigger an event whenever you check in with it. You cannot configure SOAP events - or global events that occur on the server itself - with the Java API.
I would suggest that you use a unique URI to identify the Project Collection. The query arguments would be appropriate here. To identify the Project, you need only look at the server path.
I'm not familiar with when the Project Collection GUID is delivered, but I would disambiguate by #3, above.