-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
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
View is empty, if log forced the keys/values come back #197
Comments
Once you start the view, you have to wait until it catches up with Kafka. If you query the view before fully recovering it, it won't know about the value for your key. I am not sure whether that is your case, but if it is, you can solve it by waiting the view to recover: for !view.Recovered() {
time.Sleep(time.Second)
}
...
var found interface{}
if found, err = domain.gokaBase.view.Get(string(id)); err != nil {
domain.logger.WithError(err).Error("error while searching device")
return Device{}, err
} else if found == nil {
domain.logger.Error("did not find device of given id")
return Device{}, errors.New("not found")
} The table is locally stored in Let me know if that helped. |
Thank you for your reply. I will try the code that you wrote. |
Ah, ok. Another idea: Have you created the table with a Java Client? The golang client (Sarama) uses another hashing and the views won’t find your keys. To use the same hasher as Java you have to pass it when you create the view or processor. Check issue #186. |
To create the view I used a golang client. |
@edgar86cru are you still facing problems or can I close this issue? |
@db7 sorry I forgot to reply... You can close the issue it works with the code that you passed me, the first time that I tried I forgot to Run the view. Thank you again |
Hi everybody.
I had an error trying to get some values from a View.
This is the original code:
The err and the found were always nil for all ids but I check in another project and I have some key/value stored in the View.
When I forced the log of found and err adding the code below, I get back the values of my View:
Someone have already this malfunction??
Thank you
The text was updated successfully, but these errors were encountered: