We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to add integration with Google PubSub 1.124.2 in Corda 4
compile("com.google.cloud:google-cloud-pubsub:1.124.2")
Simply I have a @CordaService which has a method to publish something to Google PubSub. It builds fine but in runtime I get this error:
Caused by: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap$Builder.buildKeepingLast()Lcom/google/common/collect/ImmutableMap;
I found that PubSub library has a dependency com.google.guava:guava:31.1-jre where ImmutableMap.buildKeepingLast method was added.
In runtime I checked that ImmutableMap was loaded from here: (file:/home/xxx/.capsule/apps/net.corda.node.CordaEnterprise_4.6.1/guava-28.0-jre.jar )
Why is that? Why Corda dependency was used instead of workflows dependency?
Code to reproduce: workflows build gradle
compile("com.google.cloud:google-cloud-pubsub:1.124.2") compile("com.google.guava:guava:31.1-jre")
Corda Service:
import com.google.api.core.ApiFuture import com.google.cloud.pubsub.v1.Publisher import com.google.protobuf.ByteString import com.google.pubsub.v1.PubsubMessage import com.google.pubsub.v1.TopicName import net.corda.core.node.AppServiceHub import net.corda.core.node.services.CordaService import net.corda.core.serialization.SingletonSerializeAsToken import net.corda.core.utilities.loggerFor import java.util.concurrent.TimeUnit @CordaService class EventBusPublisher(private val serviceHub: AppServiceHub) : SingletonSerializeAsToken() { companion object { val logger = loggerFor<EventBusPublisher>() } fun publish(message: String) { logger.info("Publishing message to event bus: $message") val topicName = TopicName.of("fragmos", "corda.event.state-change") var publisher: Publisher? = null try { // Create a publisher instance with default settings bound to the topic publisher = Publisher.newBuilder(topicName).build() val data: ByteString = ByteString.copyFromUtf8(message) val pubsubMessage: PubsubMessage = PubsubMessage.newBuilder().setData(data).build() // Once published, returns a server-assigned message id (unique within the topic) val messageIdFuture: ApiFuture<String> = publisher.publish(pubsubMessage) val messageId: String = messageIdFuture.get() logger.info("Published message ID: $messageId") } finally { if (publisher != null) { // When finished with the publisher, shutdown to free up resources. publisher.shutdown() publisher.awaitTermination(1, TimeUnit.MINUTES) } } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I want to add integration with Google PubSub 1.124.2 in Corda 4
Simply I have a @CordaService which has a method to publish something to Google PubSub. It builds fine but in runtime I get this error:
I found that PubSub library has a dependency
com.google.guava:guava:31.1-jre
where ImmutableMap.buildKeepingLast method was added.
In runtime I checked that ImmutableMap was loaded from here:
(file:/home/xxx/.capsule/apps/net.corda.node.CordaEnterprise_4.6.1/guava-28.0-jre.jar )
Why is that? Why Corda dependency was used instead of workflows dependency?
Code to reproduce:
workflows build gradle
Corda Service:
The text was updated successfully, but these errors were encountered: