如果我在 resources/graphql 文件夹中有以下两个模式,则使用 Spring-GraphQl:
架构1:
type Query {
bookById(id: ID): Book
}
type Book {
id: ID
name: String
pageCount: Int
author: Author
}
type Author {
id: ID
firstName: String
lastName: String
}
Run Code Online (Sandbox Code Playgroud)
模式2:
type Query {
personByName(name: String): Person
}
type Person {
id: ID
firstName: String
lastName: String
}
Run Code Online (Sandbox Code Playgroud)
Spring-GraphQL 似乎将它们合并到一个 GraphQL 模式文件中,并且 Spring-Boot Graphql 应用程序的启动以以下错误结束:
引起原因:graphql.schema.idl.errors.SchemaProblem:errors=['Query'类型[@1:1]尝试重新定义现有的'Query'类型[@1:1]]
当我将其更改为:
架构1:
type Query {
bookById(id: ID): Book
personByName(name: String): Person
}
Run Code Online (Sandbox Code Playgroud)
模式2:
type Book {
id: ID
name: String …Run Code Online (Sandbox Code Playgroud) 我有以下基于 Spring Cloud Stream 的应用程序的测试场景。我的应用程序有一个主题,有两个队列。第一个队列的 BindingKey 被命名为“城市”,第二个队列的绑定密钥是“人”。
请问如何为Spring Cloud Stream Rabbit生产者设置路由键???区分消息将在哪里消费?
这是我的绑定配置:
spring.config.name=streaming
spring.cloud.stream.bindings.citiesChannel.destination=streamInput
spring.cloud.stream.bindings.citiesChannel.group=cities
spring.cloud.stream.rabbit.bindings.citiesChannel.consumer.durableSubscription=true
spring.cloud.stream.rabbit.bindings.citiesChannel.consumer.bindingRoutingKey=cities
spring.cloud.stream.bindings.personsChannel.destination=streamInput
spring.cloud.stream.bindings.personsChannel.group=persons
spring.cloud.stream.rabbit.bindings.personsChannel.consumer.durableSubscription=true
spring.cloud.stream.rabbit.bindings.personsChannel.consumer.bindingRoutingKey=persons
spring.cloud.stream.bindings.producingChannel.destination=streamInput
Run Code Online (Sandbox Code Playgroud)
发布到生产频道时,如何区分消息将发送到哪里(城市或人员队列)的唯一方法是通过“spring.cloud.stream.bindings.productionChannel.producer.requiredGroups”属性,但这是非常不可用的。因为我不想知道我的消息将要到达的队列的任何信息......这是 AMPQ 反模式。
我不想要更简单的东西,然后在发布到生产频道时通过RabbitTemplate.setRoutingKey(String routingKey)方法拥有类似的功能...:-(