Skip to content

Commit caa3582

Browse files
authored
Merge pull request #114013 from SnehaGunda/tabbedconceptual
Adding tabs
2 parents 671ae2e + e5acf07 commit caa3582

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ 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/csharp)
21+
2022
```C#
2123
//set initial start time for pulling the change feed
2224
DateTime timeBegin = DateTime.UtcNow;
@@ -65,6 +67,9 @@ In each iteration, the query resumes at the last point changes were read, using
6567
}
6668

6769
```
70+
71+
# [Java](#tab/java)
72+
6873
```java
6974
Session cassandraSession = utils.getSession();
7075

@@ -99,19 +104,27 @@ In each iteration, the query resumes at the last point changes were read, using
99104
}
100105

101106
```
107+
---
108+
102109
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"
103110

111+
# [C#](#tab/csharp)
112+
104113
```C#
105114
//Return the latest change for all row in 'user' table where user_id = 1
106115
IStatement changeFeedQueryStatement = new SimpleStatement(
107116
$"SELECT * FROM uprofile.user where user_id = 1 AND COSMOS_CHANGEFEED_START_TIME() = '{timeBegin.ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture)}'");
108117

109118
```
119+
120+
# [Java](#tab/java)
121+
110122
```java
111123
String query="SELECT * FROM uprofile.user where user_id=1 and COSMOS_CHANGEFEED_START_TIME()='"
112124
+ dtf.format(now)+ "'";
113125
SimpleStatement st=new SimpleStatement(query);
114126
```
127+
---
115128
## Current limitations
116129

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

articles/cosmos-db/create-sql-api-java-changefeed.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ mvn clean package
8686

8787
# [Java SDK 4.0](#tab/v4sdk)
8888

89-
**Java SDK 4.0**
9089
```java
9190
changeFeedProcessorInstance = getChangeFeedProcessor("SampleHost_1", feedContainer, leaseContainer);
9291
changeFeedProcessorInstance.start()
@@ -101,7 +100,6 @@ mvn clean package
101100
102101
# [Java SDK 3.7.0](#tab/v3sdk)
103102
104-
**Java SDK 3.7.0**
105103
```java
106104
changeFeedProcessorInstance = getChangeFeedProcessor("SampleHost_1", feedContainer, leaseContainer);
107105
changeFeedProcessorInstance.start()
@@ -114,7 +112,7 @@ mvn clean package
114112
while (!isProcessorRunning.get()); //Wait for Change Feed processor start
115113
```
116114
---
117-
115+
118116
```"SampleHost_1"``` is the name of the Change Feed processor worker. ```changeFeedProcessorInstance.start()``` is what actually starts the Change Feed processor.
119117
120118
Return to the Azure Portal Data Explorer in your browser. Under the **InventoryContainer-leases** container, click **items** to see its contents. You will see that Change Feed Processor has populated the lease container, i.e. the processor has assigned the ```SampleHost_1``` worker a lease on some partitions of the **InventoryContainer**.
@@ -125,7 +123,6 @@ mvn clean package
125123
126124
# [Java SDK 4.0](#tab/v4sdk)
127125
128-
**Java SDK 4.0**
129126
```java
130127
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosAsyncContainer feedContainer, CosmosAsyncContainer leaseContainer) {
131128
ChangeFeedProcessorOptions cfOptions = new ChangeFeedProcessorOptions();
@@ -153,7 +150,6 @@ mvn clean package
153150
154151
# [Java SDK 3.7.0](#tab/v3sdk)
155152
156-
**Java SDK 3.7.0**
157153
```java
158154
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosContainer feedContainer, CosmosContainer leaseContainer) {
159155
ChangeFeedProcessorOptions cfOptions = new ChangeFeedProcessorOptions();
@@ -196,7 +192,6 @@ mvn clean package
196192
197193
# [Java SDK 4.0](#tab/v4sdk)
198194
199-
**Java SDK 4.0**
200195
```java
201196
public static void deleteDocument() {
202197
@@ -225,7 +220,6 @@ mvn clean package
225220
```
226221
# [Java SDK 3.7.0](#tab/v3sdk)
227222
228-
**Java SDK 3.7.0**
229223
```java
230224
public static void deleteDocument() {
231225

articles/cosmos-db/mongodb-change-streams.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The following error codes and messages are supported when using change streams:
4040

4141
The following example shows how to get change streams on all the items in the collection. This example creates a cursor to watch items when they are inserted, updated, or replaced. The `$match` stage, `$project` stage, and `fullDocument` option are required to get the change streams. Watching for delete operations using change streams is currently not supported. As a workaround, you can add a soft marker on the items that are being deleted. For example, you can add an attribute in the item called "deleted." When you'd like to delete the item, you can set "deleted" to `true` and set a TTL on the item. Since updating "deleted" to `true` is an update, this change will be visible in the change stream.
4242

43-
### JavaScript:
43+
# [JavaScript](#tab/javascript)
4444

4545
```javascript
4646
var cursor = db.coll.watch(
@@ -56,8 +56,7 @@ while (!cursor.isExhausted()) {
5656
}
5757
}
5858
```
59-
60-
### C#:
59+
# [C#](#tab/csharp)
6160

6261
```csharp
6362
var pipeline = new EmptyPipelineDefinition<ChangeStreamDocument<BsonDocument>>()

0 commit comments

Comments
 (0)