Notification
Entity Notification
登录后可跨设备保存划线和私人笔记登录
Entity Change Notifications
To receive Atlas entity notifications a consumer should be obtained through the notification interface. Entity change notifications are sent every time a change is made to an entity. Operations that result in an entity change notification are:
ENTITY_CREATE- Create a new entity.ENTITY_UPDATE- Update an attribute of an existing entity.TRAIT_ADD- Add a trait to an entity.TRAIT_DELETE- Delete a trait from an entity.
// Obtain provider through injection…
Provider<NotificationInterface> provider;
// Get the notification interface
NotificationInterface notification = provider.get();
// Create consumers
List<NotificationConsumer<EntityNotification>> consumers =
notification.createConsumers(NotificationInterface.NotificationType.ENTITIES, 1);
The consumer exposes the Iterator interface that should be used to get the entity notifications as they are posted. The hasNext() method blocks until a notification is available.
while(consumer.hasNext()) {
EntityNotification notification = consumer.next();
IReferenceableInstance entity = notification.getEntity();
…
}
评论
登录后参与评论
正在加载评论…
InfoSphere