Hi All,
I'm trying to use GCP Pub sub with spring boot and I want to publish a simple JSON message to a NodeJS API. I found this sample here: https://github.com/spring-cloud/spring-cloud-gcp/tree/main/spring-cloud-gcp-samples/spring-cloud-gcp-integration-pubsub-json-sample but when I try to add
@Bean
public JacksonPubSubMessageConverter jacksonPubSubMessageConverter(ObjectMapper objectMapper) {
return new JacksonPubSubMessageConverter(objectMapper);
}
to my project and the dependancy
implementation group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starter-logging'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starter-logging', version: '1.2.8.RELEASE'
implementation platform('com.google.cloud:libraries-bom:22.0.0')
implementation 'com.google.cloud:google-cloud-pubsub:1.114.2'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starter-pubsub'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-gcp', version: '1.2.8.RELEASE', ext: 'pom'
I get the following error: Cannot resolve symbol 'JacksonPubSubMessageConverter'
Can someone point me in the right direction? Do I need to use Spring integration?
Hello everyone, sorry for coming in with a super specific question, but I keep hitting the wall with that one:
I want to subscribe to a pubsub topic via a ReactiveFactory
like that: private val flux = reactiveFactory.poll(subscriptionName, 1000)
.
Reading and acknowledging a message is done as follows:
val consumer = flux.flatMap { pubsubMessage -> doSomeStuff(pubSubMessage) }
.doOnNext(AcknowledgeablePubsubMessage::ack)
.doOnError { log.error("Error consuming message!") }
.subscribe()
Two things are now coming up for me:
1.) I want to .nack()
the pubSubMessage if there's an error - unfortunately any kind of doOnError
, onErrorContinue
etc. has no info about that it's a pubSubMessage
that one can nack()
.
2.) I would love to work my way in with tests, but I see no way in how I can check if I correctly negatively acknowledge a message.
I would be incredibly happy if there's someone who could point me to a resource/code fragment/whatever about that - I feel like I read about everything but can't seem to find an answer for that.
Thanks in advance!
java.io.FileNotFoundException: Could not open ServletContext resource [/gs://bucketimages/hello.txt]
similar toHi, I want to store images in cloud storage and access in my spring boot app on appengine.
https://github.com/spring-cloud/spring-cloud-gcp/blob/main/spring-cloud-gcp-samples/spring-cloud-gcp-storage-resource-sample/src/main/java/com/example/WebController.java
says only about 1 file - my-file.txt
private Resource gcsFile;
There is some configuration that says - serve statis content
```# You can also serve static resources by reading them from a bucket.
com.google.cloud:spring-cloud-gcp-pubsub-stream-binder:2.0.4
and having trouble getting publisher errors. It looks like PubSubMessageHandler
exposes a method to setFailureCallback
but none seem to get registered, nor can I see how to register my own. I'm missing something really obvious right?
Running a set of spring cloud stream applications. Seeing some exceptions when publishing messages to PubSub as part of a data processing stream.
com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: The request contains an attribute key that is not valid (key=googclient_deliveryattempt). Attribute keys must be non-empty and must not begin with 'goog' (case-insensitive).
I'm not explicitly assigning this attribute, so I can only imagine it's getting assigned to the output message via inheritance from the input message?
@Document(collectionName = "users")
public class User {
@DocumentId
private String documentId;
@ServerTimestamp
private Date lastModified;
public User() {
}
public String getDocumentId() {
return documentId;
}
public void setDocumentId(String documentId) {
this.documentId = documentId;
}
@PropertyName("last_modified")
public Date getLastModified() {
return lastModified;
}
@PropertyName("last_modified")
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}
}
Hi. I have a Spring Boot application deployed on Google Clod Platform and want to use Google Trace service for tracing. I use the following libraries:
- org.springframework.cloud:spring-cloud-starter-sleuth
- com.google.cloud:spring-cloud-gcp-starter-trace
- com.google.cloud:spring-cloud-gcp-starter-logging
and in configuration I have:
spring.sleuth.enabled=true
spring.sleuth.propagation.type=B3
spring.sleuth.sampler.probability=1.0
spring.cloud.gcp.core.enabled=true
spring.cloud.gcp.logging.enabled=true
spring.cloud.gcp.trace.enabled=true
Although I have sampler probability = 1.0 and don't see all request sampled on GCP Trace List page. Could someone explain me what is the Google Trace logic, in which conditions GCP will do sampling? Can I somehow in configuration force sampling?
Thank you.
hello, what's the best way to parse tracing data from the http request body? For reactor and servlet based servers.
Use case: we're leveraging pubsub push subscriptions which don't add any request headers, pubsub template already puts tracing data as message attributes.