/*!
 * IMQService implementation
 *
 * Copyright (c) 2018, imqueue.com <support@imqueue.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */
import { JsonObject, ILogger, IMessageQueue } from '@imqueue/core';
import { TypesDescription, IMQRPCRequest, IMQRPCResponse, IMQServiceOptions, ICache, MethodsCollectionDescription } from '.';
export declare class Description {
    service: {
        name: string;
        methods: MethodsCollectionDescription;
    };
    types: TypesDescription;
}
/**
 * Class IMQService
 * Basic abstract service (server-side) implementation
 */
export declare abstract class IMQService {
    [property: string]: any;
    protected imq: IMessageQueue;
    protected logger: ILogger;
    protected cache: ICache;
    name: string;
    options: IMQServiceOptions;
    /**
     * Class constructor
     *
     * @constructor
     * @param {Partial<IMQServiceOptions>} options
     * @param {string} [name]
     */
    constructor(options?: Partial<IMQServiceOptions>, name?: string);
    /**
     * Handles incoming request and produces corresponding response
     *
     * @access private
     * @param {IMQRPCRequest} request - request message
     * @param {string} id - message unique identifier
     * @return {Promise<string>}
     */
    private handleRequest;
    /**
     * Initializes this instance of service and starts handling request
     * messages.
     *
     * @return {Promise<IMessageQueue>}
     */
    start(): Promise<IMessageQueue | undefined>;
    /**
     * Sends given data to service subscription channel
     *
     * @param {JsonObject} data
     */
    publish(data: JsonObject): Promise<void>;
    /**
     * Stops service from handling messages
     *
     * @return {Promise<void>}
     */
    stop(): Promise<void>;
    /**
     * Destroys this instance of service
     *
     * @return {Promise<void>}
     */
    destroy(): Promise<void>;
    /**
     * Returns service description metadata.
     *
     * @returns {Promise<Description>}
     */
    describe(): Description;
}
/**
 * Sends IMQ response with support of after call optional hook
 *
 * @param {IMQRPCRequest} request - from message identifier
 * @param {IMQRPCResponse} response - response to send
 * @param {IMQService} service - imq service to bind
 * @return {Promise<string>} - send result message identifier
 */
export declare function send(request: IMQRPCRequest, response: IMQRPCResponse, service: IMQService): Promise<string>;
