Search in sources :

Example 1 with DBEventSubscriber

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

the class RegistryServiceDBEventMessagingFactory method registerRegistryServiceWithPublishers.

public static boolean registerRegistryServiceWithPublishers(List<String> publisherList) throws AiravataException {
    for (String publisher : publisherList) {
        logger.info("Sending service discovery message. Publisher: " + publisher + ", Subscriber: " + DBEventService.REGISTRY.toString());
        DBEventSubscriber dbEventSubscriber = new DBEventSubscriber(DBEventService.REGISTRY.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)

Example 2 with DBEventSubscriber

use of org.apache.airavata.model.dbevent.DBEventSubscriber 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

MessageContext (org.apache.airavata.messaging.core.MessageContext)2 DBEventMessage (org.apache.airavata.model.dbevent.DBEventMessage)2 DBEventMessageContext (org.apache.airavata.model.dbevent.DBEventMessageContext)2 DBEventSubscriber (org.apache.airavata.model.dbevent.DBEventSubscriber)2