Infinispan在Kubernetes上作为Vert.x集群管理器和缓存管理器的双重角色。缓存不共享问题),我正在配置Infinispan的集群管理器和缓存管理器实例以实现其双重用途功能。
目标是将嵌入式 Java 对象(Embedding
类)存储在 Infinispan 缓存集合中,允许它们在集群成员之间共享。这是
Embedding
课程:
public class Embedding {
@ProtoField(number = 1, collectionImplementation = ArrayList.class)
List<Float> latentScores;
@ProtoField(number = 2)
String document;
@ProtoFactory
public Embedding(List<Float> latentScores, String document) {
this.latentScores = latentScores;
this.document = document;
}
// ...
}
,ProtoSchema
类的
Embedding
读作:
@ProtoSchema(
includeClasses = {Embedding.class},
schemaFileName = "embedding.proto",
schemaFilePath = "proto"
)
public interface EmbeddingSchema extends GeneratedSchema {
}
运行应用程序时,我可以在构建工件目录 (\build\generated\sources\annotationProcessor\java\main\cynicdog\io\data\
) 中看到正在创建的两个生成的类,
EmbeddingSchemaImpl
和
Embedding$___Marshaller_95fa3eee
。但是,它
无法构建,错误消息如下:
Vertx-Kubernetes-Integration-Templates\clustered-embedding-stores\backend\build\generated\sources\annotationProcessor\java\main\cynicdog\io\data\EmbeddingSchemaImpl.java:16: error: package org.infinispan.protostream.annotations.impl.processor does not exist
@org.infinispan.protostream.annotations.impl.processor.OriginatingClasses({
^
,即使我在 build.gradle
脚本中指定注释处理器路径。我清理了 Gradle 缓存并重建了依赖项和项目,但是
我仍然遇到错误,指示找不到 infinispan.protostream.annotations.impl.processor
。这是项目依赖部分和版本规格的
build.gradle
:
ext {
vertxVersion = '4.5.11'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("io.vertx:vertx-web:${vertxVersion}")
implementation("io.vertx:vertx-web-client:${vertxVersion}")
implementation("io.vertx:vertx-infinispan:${vertxVersion}")
implementation("io.vertx:vertx-health-check:${vertxVersion}")
// https://mvnrepository.com/artifact/org.infinispan.protostream/protostream
implementation 'org.infinispan.protostream:protostream:5.0.12.Final'
// https://mvnrepository.com/artifact/org.infinispan.protostream/protostream-processor
annotationProcessor 'org.infinispan.protostream:protostream-processor:5.0.5.Final'
testImplementation 'org.infinispan:infinispan-commons:15.0.0.Final'
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
如果需要详细检查,我将附加项目 GitHub 存储库:https://github.com/CynicDog/Vertx-Kubernetes-Integration-Templates/blob/protostream-integration/clustered-embedding-stores/backend/src/main/java/cynicdog/io/Main.java
我非常感谢您的指导和支持,帮助我解决这个问题并教我更多关于 Infinispan 的知识!
implementation 'org.infinispan.protostream:protostream-processor:5.0.5.Final'
在
build.gradle
依赖项列表上解决了构建失败😅