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

com.evento.common.messaging.gateway.QueryGateway Maven / Gradle / Ivy

The newest version!
package com.evento.common.messaging.gateway;

import com.evento.common.modeling.messaging.message.application.Message;
import com.evento.common.modeling.messaging.message.application.Metadata;
import com.evento.common.modeling.messaging.payload.Query;
import com.evento.common.modeling.messaging.query.QueryResponse;

import java.util.concurrent.CompletableFuture;

/**
 * The QueryGateway interface provides a way to send queries and receive the corresponding responses asynchronously.
 */
public interface QueryGateway {
	/**
	 * Queries the system with the given Query object and returns a CompletableFuture representing the response.
	 *
	 * @param query The Query object to be sent to the system.
	 * @param  The type of QueryResponse expected as the response.
	 * @return A CompletableFuture that resolves to the response of the query.
	 */
	default > CompletableFuture query(Query query) {
		return query(query, null);
	}




	/**
	 * Executes a query asynchronously and returns the corresponding response.
	 *
	 * @param query           The query object to be sent to the system.
	 * @param metadata        The metadata associated with the query.
	 * @param              The type parameter of the QueryResponse expected as the response.
	 * @return A CompletableFuture that resolves to the response of the query.
	 */
	default > CompletableFuture query(Query query, Metadata metadata) {
		return query(query, metadata, null);
	}

	/**
	 * Executes a query asynchronously and returns the corresponding response.
	 *
	 * @param query           The query object to be sent to the system.
	 * @param metadata        The metadata associated with the query.
	 * @param handledMessage  The handled message associated with the query.
	 * @param              The type parameter of the QueryResponse expected as the response.
	 * @return A CompletableFuture that resolves to the response of the query.
	 */
	> CompletableFuture query(Query query, Metadata metadata, Message handledMessage);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy