I'm implementing chat server currently, with dynamoDB.
Here is keys from ChatData table
- Primary partition key : roomNo
- Primary sort key : seq
Chat server, can created many instant rooms, approximated to 100~120 daily. So I choosed primary partition key as room Number(roomNo), and sort by data created time(or sequential value) on seq.
I want to increase seq automatically, however, I know that DynamoDB hasn't support such as
identity. So, I'm going to try using
AtomicLong from my client application(JAVA 1.8).
But, each has problems.
Timestamp, may inserted duplicated value in table.
AtomicLong, can increased atomic value but when I restart my application, it starts from 1 again.
Maybe if I can get maximum
seq value from DynamoDB, what should I use for?
or how to change keys on table?