Search in sources :

Example 6 with DBEventMessage

use of org.apache.airavata.model.dbevent.DBEventMessage in project airavata by apache.

the class SharingServiceDBEventMessagingFactory method registerSharingServiceWithPublishers.

/**
 * Register sharing service with stated publishers
 * @param publishers
 * @return
 * @throws AiravataException
 */
public static boolean registerSharingServiceWithPublishers(List<String> publishers) throws AiravataException {
    for (String publisher : publishers) {
        log.info("Sending service discovery message. Publisher : " + publisher + ", Subscriber : " + DBEventService.SHARING.toString());
        DBEventSubscriber dbEventSubscriber = new DBEventSubscriber(DBEventService.SHARING.toString());
        DBEventMessageContext dbEventMessageContext = new DBEventMessageContext();
        dbEventMessageContext.setSubscriber(dbEventSubscriber);
        DBEventMessage dbEventMessage = new DBEventMessage(DBEventType.SUBSCRIBER, dbEventMessageContext, publisher);
        MessageContext messageContext = new MessageContext(dbEventMessage, MessageType.DB_EVENT, "", "");
        getDBEventPublisher().publish(messageContext, DBEventManagerConstants.getRoutingKey(DBEventService.DB_EVENT.toString()));
    }
    return true;
}
Also used : DBEventMessage(org.apache.airavata.model.dbevent.DBEventMessage) DBEventMessageContext(org.apache.airavata.model.dbevent.DBEventMessageContext) DBEventSubscriber(org.apache.airavata.model.dbevent.DBEventSubscriber) MessageContext(org.apache.airavata.messaging.core.MessageContext) DBEventMessageContext(org.apache.airavata.model.dbevent.DBEventMessageContext)

Aggregations

DBEventMessage (org.apache.airavata.model.dbevent.DBEventMessage)6 DBEventMessageContext (org.apache.airavata.model.dbevent.DBEventMessageContext)5 MessageContext (org.apache.airavata.messaging.core.MessageContext)4 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)3 TException (org.apache.thrift.TException)3 AiravataException (org.apache.airavata.common.exception.AiravataException)2 DBEventSubscriber (org.apache.airavata.model.dbevent.DBEventSubscriber)2 DuplicateEntryException (org.apache.airavata.model.error.DuplicateEntryException)2 UserProfile (org.apache.airavata.model.user.UserProfile)2 Gateway (org.apache.airavata.model.workspace.Gateway)2 DBEventManagerException (org.apache.airavata.db.event.manager.messaging.DBEventManagerException)1 DBEventPublisherContext (org.apache.airavata.model.dbevent.DBEventPublisherContext)1 Message (org.apache.airavata.model.messaging.event.Message)1 Domain (org.apache.airavata.sharing.registry.models.Domain)1 PermissionType (org.apache.airavata.sharing.registry.models.PermissionType)1 User (org.apache.airavata.sharing.registry.models.User)1