All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rapture.kernel.PipelineApiImplWrapper Maven / Gradle / Ivy

There is a newer version: 3.0.4
Show newest version
/**
 * The MIT License (MIT)
 *
 * Copyright (C) 2011-2016 Incapture Technologies LLC
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/**
 * This is an autogenerated file. You should not edit this file as any changes
 * will be overwritten.
 */

package rapture.kernel;

import org.apache.log4j.Logger;

import java.util.List;
import java.util.Map;

import rapture.common.api.PipelineApi;
import rapture.common.CallingContext;
import rapture.common.RaptureEntitlementsContext;

import rapture.common.hooks.CallName;

import rapture.common.model.BasePayload;
import rapture.common.EntitlementSet;
import rapture.kernel.context.ContextValidator;

import rapture.common.RapturePipelineTask;
import rapture.common.model.RaptureExchange;
import rapture.common.TableQuery;
import rapture.common.CategoryQueueBindings;
import rapture.common.PipelineTaskStatus;

import rapture.common.shared.pipeline.RemoveServerCategoryPayload;

import rapture.common.shared.pipeline.GetServerCategoriesPayload;

import rapture.common.shared.pipeline.GetBoundExchangesPayload;

import rapture.common.shared.pipeline.DeregisterPipelineExchangePayload;

import rapture.common.shared.pipeline.GetExchangesPayload;

import rapture.common.shared.pipeline.GetExchangePayload;

import rapture.common.shared.pipeline.PublishMessageToCategoryPayload;

import rapture.common.shared.pipeline.BroadcastMessageToCategoryPayload;

import rapture.common.shared.pipeline.BroadcastMessageToAllPayload;

import rapture.common.shared.pipeline.GetStatusPayload;

import rapture.common.shared.pipeline.QueryTasksPayload;

import rapture.common.shared.pipeline.QueryTasksOldPayload;

import rapture.common.shared.pipeline.GetLatestTaskEpochPayload;

import rapture.common.shared.pipeline.DrainPipelinePayload;

import rapture.common.shared.pipeline.RegisterExchangeDomainPayload;

import rapture.common.shared.pipeline.DeregisterExchangeDomainPayload;

import rapture.common.shared.pipeline.GetExchangeDomainsPayload;

import rapture.common.shared.pipeline.SetupStandardCategoryPayload;

import rapture.common.shared.pipeline.MakeRPCPayload;

import rapture.common.shared.pipeline.CreateTopicExchangePayload;

import rapture.common.shared.pipeline.PublishTopicMessagePayload;


/**
 * This class is a wrapper around the class {@link PipelineApiImpl}. This is an auto-generated class that gives us the ability to add hooks such as entitlmeent
 * checks before each function call in the implementation. Since we always want to call these hooks, an instance of this class should be used 
 * (in {@link Kernel}) instead of using the implementation directly.
 * implementation directly. 
 *
 */
@SuppressWarnings("all")
public class PipelineApiImplWrapper implements PipelineApi, KernelApi {
    private static final Logger log = Logger.getLogger(PipelineApiImplWrapper.class);
    private PipelineApiImpl apiImpl;

    public PipelineApiImplWrapper(Kernel kernel) {
        apiImpl = new PipelineApiImpl(kernel);
    }

    /**
     * Returns the underlying implementation object. This should be used when a call is deliberately bypassing entitlement checks.
     * @return {@link Pipeline}
     */
    public PipelineApiImpl getTrusted() {
        return apiImpl;
    }

    @Override
    public void start() {
        apiImpl.start();
    }

    /**
    * 
    */
    @Override
    public void removeServerCategory(CallingContext context, String category) {
        long functionStartTime = System.currentTimeMillis();
       
        RemoveServerCategoryPayload requestObj = new RemoveServerCategoryPayload();
        requestObj.setContext(context);
        requestObj.setCategory(category);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_removeServerCategory, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_removeServerCategory);
        apiImpl.removeServerCategory(context, category);    Kernel.getApiHooksService().post(context, CallName.Pipeline_removeServerCategory);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.removeServerCategory.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.removeServerCategory.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public List getServerCategories(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetServerCategoriesPayload requestObj = new GetServerCategoriesPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_getServerCategories, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_getServerCategories);
        List returnValue = apiImpl.getServerCategories(context);    Kernel.getApiHooksService().post(context, CallName.Pipeline_getServerCategories);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getServerCategories.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getServerCategories.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public List getBoundExchanges(CallingContext context, String category) {
        long functionStartTime = System.currentTimeMillis();
       
        GetBoundExchangesPayload requestObj = new GetBoundExchangesPayload();
        requestObj.setContext(context);
        requestObj.setCategory(category);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_getBoundExchanges, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_getBoundExchanges);
        List returnValue = apiImpl.getBoundExchanges(context, category);    Kernel.getApiHooksService().post(context, CallName.Pipeline_getBoundExchanges);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getBoundExchanges.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getBoundExchanges.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public void deregisterPipelineExchange(CallingContext context, String name) {
        long functionStartTime = System.currentTimeMillis();
       
        DeregisterPipelineExchangePayload requestObj = new DeregisterPipelineExchangePayload();
        requestObj.setContext(context);
        requestObj.setName(name);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_deregisterPipelineExchange, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_deregisterPipelineExchange);
        apiImpl.deregisterPipelineExchange(context, name);    Kernel.getApiHooksService().post(context, CallName.Pipeline_deregisterPipelineExchange);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.deregisterPipelineExchange.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.deregisterPipelineExchange.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public List getExchanges(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetExchangesPayload requestObj = new GetExchangesPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_getExchanges, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_getExchanges);
        List returnValue = apiImpl.getExchanges(context);    Kernel.getApiHooksService().post(context, CallName.Pipeline_getExchanges);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getExchanges.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getExchanges.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public RaptureExchange getExchange(CallingContext context, String name) {
        long functionStartTime = System.currentTimeMillis();
       
        GetExchangePayload requestObj = new GetExchangePayload();
        requestObj.setContext(context);
        requestObj.setName(name);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_getExchange, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_getExchange);
        RaptureExchange returnValue = apiImpl.getExchange(context, name);    Kernel.getApiHooksService().post(context, CallName.Pipeline_getExchange);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getExchange.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getExchange.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public void publishMessageToCategory(CallingContext context, RapturePipelineTask task) {
        long functionStartTime = System.currentTimeMillis();
       
        PublishMessageToCategoryPayload requestObj = new PublishMessageToCategoryPayload();
        requestObj.setContext(context);
        requestObj.setTask(task);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_publishMessageToCategory, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_publishMessageToCategory);
        apiImpl.publishMessageToCategory(context, task);    Kernel.getApiHooksService().post(context, CallName.Pipeline_publishMessageToCategory);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.publishMessageToCategory.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.publishMessageToCategory.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void broadcastMessageToCategory(CallingContext context, RapturePipelineTask task) {
        long functionStartTime = System.currentTimeMillis();
       
        BroadcastMessageToCategoryPayload requestObj = new BroadcastMessageToCategoryPayload();
        requestObj.setContext(context);
        requestObj.setTask(task);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_broadcastMessageToCategory, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_broadcastMessageToCategory);
        apiImpl.broadcastMessageToCategory(context, task);    Kernel.getApiHooksService().post(context, CallName.Pipeline_broadcastMessageToCategory);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.broadcastMessageToCategory.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.broadcastMessageToCategory.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void broadcastMessageToAll(CallingContext context, RapturePipelineTask task) {
        long functionStartTime = System.currentTimeMillis();
       
        BroadcastMessageToAllPayload requestObj = new BroadcastMessageToAllPayload();
        requestObj.setContext(context);
        requestObj.setTask(task);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_broadcastMessageToAll, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_broadcastMessageToAll);
        apiImpl.broadcastMessageToAll(context, task);    Kernel.getApiHooksService().post(context, CallName.Pipeline_broadcastMessageToAll);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.broadcastMessageToAll.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.broadcastMessageToAll.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public PipelineTaskStatus getStatus(CallingContext context, String taskId) {
        long functionStartTime = System.currentTimeMillis();
       
        GetStatusPayload requestObj = new GetStatusPayload();
        requestObj.setContext(context);
        requestObj.setTaskId(taskId);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_getStatus, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_getStatus);
        PipelineTaskStatus returnValue = apiImpl.getStatus(context, taskId);    Kernel.getApiHooksService().post(context, CallName.Pipeline_getStatus);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getStatus.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getStatus.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public List queryTasks(CallingContext context, String query) {
        long functionStartTime = System.currentTimeMillis();
       
        QueryTasksPayload requestObj = new QueryTasksPayload();
        requestObj.setContext(context);
        requestObj.setQuery(query);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_queryTasks, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_queryTasks);
        List returnValue = apiImpl.queryTasks(context, query);    Kernel.getApiHooksService().post(context, CallName.Pipeline_queryTasks);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.queryTasks.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.queryTasks.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public List queryTasksOld(CallingContext context, TableQuery query) {
        long functionStartTime = System.currentTimeMillis();
       
        QueryTasksOldPayload requestObj = new QueryTasksOldPayload();
        requestObj.setContext(context);
        requestObj.setQuery(query);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_queryTasksOld, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_queryTasksOld);
        List returnValue = apiImpl.queryTasksOld(context, query);    Kernel.getApiHooksService().post(context, CallName.Pipeline_queryTasksOld);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.queryTasksOld.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.queryTasksOld.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public Long getLatestTaskEpoch(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetLatestTaskEpochPayload requestObj = new GetLatestTaskEpochPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_getLatestTaskEpoch, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_getLatestTaskEpoch);
        Long returnValue = apiImpl.getLatestTaskEpoch(context);    Kernel.getApiHooksService().post(context, CallName.Pipeline_getLatestTaskEpoch);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getLatestTaskEpoch.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getLatestTaskEpoch.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public void drainPipeline(CallingContext context, String exchange) {
        long functionStartTime = System.currentTimeMillis();
       
        DrainPipelinePayload requestObj = new DrainPipelinePayload();
        requestObj.setContext(context);
        requestObj.setExchange(exchange);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_drainPipeline, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_drainPipeline);
        apiImpl.drainPipeline(context, exchange);    Kernel.getApiHooksService().post(context, CallName.Pipeline_drainPipeline);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.drainPipeline.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.drainPipeline.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void registerExchangeDomain(CallingContext context, String domainURI, String config) {
        long functionStartTime = System.currentTimeMillis();
       
        RegisterExchangeDomainPayload requestObj = new RegisterExchangeDomainPayload();
        requestObj.setContext(context);
        requestObj.setDomainURI(domainURI);
        requestObj.setConfig(config);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_registerExchangeDomain, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_registerExchangeDomain);
        apiImpl.registerExchangeDomain(context, domainURI, config);    Kernel.getApiHooksService().post(context, CallName.Pipeline_registerExchangeDomain);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.registerExchangeDomain.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.registerExchangeDomain.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void deregisterExchangeDomain(CallingContext context, String domainURI) {
        long functionStartTime = System.currentTimeMillis();
       
        DeregisterExchangeDomainPayload requestObj = new DeregisterExchangeDomainPayload();
        requestObj.setContext(context);
        requestObj.setDomainURI(domainURI);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_deregisterExchangeDomain, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_deregisterExchangeDomain);
        apiImpl.deregisterExchangeDomain(context, domainURI);    Kernel.getApiHooksService().post(context, CallName.Pipeline_deregisterExchangeDomain);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.deregisterExchangeDomain.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.deregisterExchangeDomain.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public List getExchangeDomains(CallingContext context) {
        long functionStartTime = System.currentTimeMillis();
       
        GetExchangeDomainsPayload requestObj = new GetExchangeDomainsPayload();
        requestObj.setContext(context);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_getExchangeDomains, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_getExchangeDomains);
        List returnValue = apiImpl.getExchangeDomains(context);    Kernel.getApiHooksService().post(context, CallName.Pipeline_getExchangeDomains);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getExchangeDomains.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.getExchangeDomains.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public void setupStandardCategory(CallingContext context, String category) {
        long functionStartTime = System.currentTimeMillis();
       
        SetupStandardCategoryPayload requestObj = new SetupStandardCategoryPayload();
        requestObj.setContext(context);
        requestObj.setCategory(category);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_setupStandardCategory, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_setupStandardCategory);
        apiImpl.setupStandardCategory(context, category);    Kernel.getApiHooksService().post(context, CallName.Pipeline_setupStandardCategory);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.setupStandardCategory.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.setupStandardCategory.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public Map makeRPC(CallingContext context, String queueName, String fnName, Map params, Long timeoutInSeconds) {
        long functionStartTime = System.currentTimeMillis();
       
        MakeRPCPayload requestObj = new MakeRPCPayload();
        requestObj.setContext(context);
        requestObj.setQueueName(queueName);
        requestObj.setFnName(fnName);
        requestObj.setParams(params);
        requestObj.setTimeoutInSeconds(timeoutInSeconds);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_makeRPC, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_makeRPC);
        Map returnValue = apiImpl.makeRPC(context, queueName, fnName, params, timeoutInSeconds);    Kernel.getApiHooksService().post(context, CallName.Pipeline_makeRPC);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.makeRPC.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.makeRPC.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
        return returnValue;}

    /**
    * 
    */
    @Override
    public void createTopicExchange(CallingContext context, String domain, String exchange) {
        long functionStartTime = System.currentTimeMillis();
       
        CreateTopicExchangePayload requestObj = new CreateTopicExchangePayload();
        requestObj.setContext(context);
        requestObj.setDomain(domain);
        requestObj.setExchange(exchange);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_createTopicExchange, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_createTopicExchange);
        apiImpl.createTopicExchange(context, domain, exchange);    Kernel.getApiHooksService().post(context, CallName.Pipeline_createTopicExchange);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.createTopicExchange.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.createTopicExchange.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

    /**
    * 
    */
    @Override
    public void publishTopicMessage(CallingContext context, String domain, String exchange, String topic, String message) {
        long functionStartTime = System.currentTimeMillis();
       
        PublishTopicMessagePayload requestObj = new PublishTopicMessagePayload();
        requestObj.setContext(context);
        requestObj.setDomain(domain);
        requestObj.setExchange(exchange);
        requestObj.setTopic(topic);
        requestObj.setMessage(message);
        ContextValidator.validateContext(context, EntitlementSet.Pipeline_publishTopicMessage, requestObj); 
        
        long preToPostStartTime = System.currentTimeMillis();
        
        Kernel.getApiHooksService().pre(context, CallName.Pipeline_publishTopicMessage);
        apiImpl.publishTopicMessage(context, domain, exchange, topic, message);    Kernel.getApiHooksService().post(context, CallName.Pipeline_publishTopicMessage);
        
        long endFunctionTime = System.currentTimeMillis();
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.publishTopicMessage.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
        Kernel.getMetricsService().recordTimeDifference("apiMetrics.pipelineApi.publishTopicMessage.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
            
    }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy