org.axonframework.queryhandling.QueryGateway Java Examples

The following examples show how to use org.axonframework.queryhandling.QueryGateway. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TraderAggregateDataInitializer.java    From ESarch with Apache License 2.0 5 votes vote down vote up
public TraderAggregateDataInitializer(CommandGateway commandGateway,
                                      EventStore eventStore,
                                      QueryGateway queryGateway,
                                      CommandRouter commandRouter) {
  this.commandGateway = commandGateway;
  this.eventStore = eventStore;
  this.queryGateway = queryGateway;
  this.commandRouter = commandRouter;
}
 
Example #2
Source File: AxonCdiExtension.java    From cdi with Apache License 2.0 5 votes vote down vote up
<T> void processQueryGatewayProducer(
        @Observes final ProcessProducer<T, QueryGateway> processProducer) {
    // TODO Handle multiple producer definitions.

    logger.debug("Producer for query gateway found: {}.",
            processProducer.getProducer());

    this.queryGatewayProducer = processProducer.getProducer();
}
 
Example #3
Source File: QueryController.java    From ESarch with Apache License 2.0 4 votes vote down vote up
public QueryController(QueryGateway queryGateway) {
    this.queryGateway = queryGateway;
}
 
Example #4
Source File: QueryContractTest.java    From ESarch with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Before
public void setup() {
    final QueryGateway queryGateway = mock(QueryGateway.class);

    // Default to an empty CompletableFuture for InstanceResponseType queries - specify working queries later
    when(queryGateway.query(any(), any(InstanceResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(null));
    // Default to a empty List CompletableFuture for MultipleInstancesResponseType queries - specify working queries later
    when(queryGateway.query(any(), any(MultipleInstancesResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(Collections.emptyList()));

    when(queryGateway.query(argThat(this::matchCompanyByIdQuery), any(InstanceResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildCompanyView()));
    when(queryGateway.query(any(FindAllCompaniesQuery.class), any(MultipleInstancesResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildAllCompaniesView()));
    when(queryGateway.query(argThat(this::matchOrderBookByIdQuery), any(InstanceResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildOrderBookView()));
    when(queryGateway.query(argThat(this::matchOrderBooksByCompanyIdQuery),
                            any(MultipleInstancesResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(Collections.singletonList(buildOrderBookView())));
    when(queryGateway.query(argThat(this::matchTransactionByIdQuery), any(InstanceResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildTransactionView()));
    when(queryGateway.query(argThat(this::matchTransactionsByPortfolioIdQuery),
                            any(MultipleInstancesResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(Collections.singletonList(buildTransactionView())));
    when(queryGateway.query(argThat(this::matchExecutedTradesByOrderBookIdQuery),
                            any(MultipleInstancesResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(Collections.singletonList(buildTradeExecutedView())));
    when(queryGateway.query(argThat(this::matchPortfolioByIdQuery), any(InstanceResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildPortfolioView()));
    when(queryGateway.query(argThat(this::matchPortfolioByUserIdQuery), any(InstanceResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildPortfolioView()));
    when(queryGateway.query(argThat(this::matchUserByIdQuery), any(InstanceResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildUserView()));
    when(queryGateway.query(any(FindAllUsersQuery.class), any(MultipleInstancesResponseType.class)))
            .thenReturn(CompletableFuture.completedFuture(buildAllUsersView()));

    final QueryController queryController = new QueryController(queryGateway);

    RestAssuredMockMvc.standaloneSetup(queryController);
}
 
Example #5
Source File: GcGuiConfiguration.java    From giftcard-demo with Apache License 2.0 4 votes vote down vote up
@EventListener(ApplicationReadyEvent.class)
public void helloHub(ApplicationReadyEvent event) {
	QueryGateway queryGateway = event.getApplicationContext().getBean(QueryGateway.class);
	queryGateway.query(new CountCardSummariesQuery(),
			ResponseTypes.instanceOf(CountCardSummariesResponse.class));
}
 
Example #6
Source File: GiftcardUI.java    From giftcard-demo with Apache License 2.0 4 votes vote down vote up
public GiftcardUI(CommandGateway commandGateway, QueryGateway queryGateway) {
    this.commandGateway = commandGateway;
    this.queryGateway = queryGateway;
}
 
Example #7
Source File: AxonQueries.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
protected AxonQueries(QueryGateway queryGateway) {
    this.queryGateway = queryGateway;
}
 
Example #8
Source File: UserQueries.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
protected UserQueries(QueryGateway queryGateway) {
    super(queryGateway);
}
 
Example #9
Source File: ApplicationDirectoryGroupsQueries.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
protected ApplicationDirectoryGroupsQueries(QueryGateway queryGateway) {
    super(queryGateway);
}
 
Example #10
Source File: ModuleQueries.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
protected ModuleQueries(QueryGateway queryGateway) {
    super(queryGateway);
}
 
Example #11
Source File: PlatformQueries.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
protected PlatformQueries(QueryGateway queryGateway) {
    super(queryGateway);
    this.queryGateway = queryGateway;
}
 
Example #12
Source File: EventQueries.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
protected EventQueries(QueryGateway queryGateway) {
    super(queryGateway);
}
 
Example #13
Source File: TechnoQueries.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
protected TechnoQueries(QueryGateway queryGateway) {
    super(queryGateway);
}
 
Example #14
Source File: OrderRestEndpoint.java    From tutorials with MIT License 4 votes vote down vote up
public OrderRestEndpoint(CommandGateway commandGateway, QueryGateway queryGateway) {
    this.commandGateway = commandGateway;
    this.queryGateway = queryGateway;
}