Skip to content

Commit 7c279b7

Browse files
committed
Adding tabs
1 parent af8f63d commit 7c279b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

articles/cosmos-db/cassandra-change-feed.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The following example shows how to get a change feed on all the rows in a Cassan
1717

1818
In each iteration, the query resumes at the last point changes were read, using paging state. We can see a continuous stream of new changes to the table in the Keyspace. We will see changes to rows that are inserted, or updated. Watching for delete operations using change feed in Cassandra API is currently not supported.
1919

20+
# [C#](#tab/c#)
2021
```C#
2122
//set initial start time for pulling the change feed
2223
DateTime timeBegin = DateTime.UtcNow;
@@ -65,6 +66,7 @@ In each iteration, the query resumes at the last point changes were read, using
6566
}
6667

6768
```
69+
# [Java](#tab/java)
6870
```java
6971
Session cassandraSession = utils.getSession();
7072

@@ -99,19 +101,25 @@ In each iteration, the query resumes at the last point changes were read, using
99101
}
100102

101103
```
104+
---
105+
102106
In order to get the changes to a single row by primary key, you can add the primary key in the query. The following example shows how to track changes for the row where "user_id = 1"
103107

108+
# [C#](#tab/c#)
104109
```C#
105110
//Return the latest change for all row in 'user' table where user_id = 1
106111
IStatement changeFeedQueryStatement = new SimpleStatement(
107112
$"SELECT * FROM uprofile.user where user_id = 1 AND COSMOS_CHANGEFEED_START_TIME() = '{timeBegin.ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture)}'");
108113

109114
```
115+
116+
# [Java](#tab/java)
110117
```java
111118
String query="SELECT * FROM uprofile.user where user_id=1 and COSMOS_CHANGEFEED_START_TIME()='"
112119
+ dtf.format(now)+ "'";
113120
SimpleStatement st=new SimpleStatement(query);
114121
```
122+
---
115123
## Current limitations
116124

117125
The following limitations are applicable when using change feed with Cassandra API:

0 commit comments

Comments
 (0)