0
votes

I have multiple consumers for an API who post similar data into my API. My API needs to consume this data and persist the data into cassandra tables identified by consumer name. Eg. consumername_tablename

My spring boot entity is annotated with @Table which doesn't let me change the table name dynamically. Most recommendations online suggest that its not something we should try and change.

But in my scenario identifying all consumers and creating table in advance doesnt sound right. In future I want to be able to add consumers to my API seamlessly.

I want to use a variable passed in my API call as the prefix for my cassandra table names. Is this something I can achieve?

1

1 Answers

1
votes

For starters: You cannot change annotations without recompiling- they are baked into the compiled class file. This is not the right approach.

Why not put everything in one table and make consumer part of the key? This should give you identical functionality without any of the hassle.