{"id":255,"date":"2019-12-02T10:45:23","date_gmt":"2019-12-02T18:45:23","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/cosmosdb\/?p=255"},"modified":"2020-03-14T08:30:20","modified_gmt":"2020-03-14T15:30:20","slug":"announcing-change-feed-support-for-azure-cosmos-dbs-cassandra-api","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/announcing-change-feed-support-for-azure-cosmos-dbs-cassandra-api\/","title":{"rendered":"Announcing: Change Feed support for Azure Cosmos DB\u2019s Cassandra API"},"content":{"rendered":"<p>Azure Cosmos DB now has GA support for <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/cosmos-db\/change-feed\">Change Feed<\/a> for its Cassandra API. This now allows users of Azure Cosmos DB&#8217;s Cassandra API to get the same great advantages of using Change Feed as enjoyed by users of SQL (Core) API and MongoDB API.<\/p>\n<h2><span style=\"font-size: 14pt;\"><strong>What is Change Feed?<\/strong><\/span><\/h2>\n<p>Azure Cosmos DB&#8217;s Change Feed is a persistent log of documents within a container. A common design pattern is to use changes to the data to trigger additional actions. Examples of additional actions include:<\/p>\n<ul>\n<li>Triggering a notification or API call when an item is inserted or updated.<\/li>\n<li>Real-time stream processing for IoT or real-time analytics processing on operational data.<\/li>\n<li>Additional data movement by either synchronizing with a cache or a search engine or a data warehouse or archiving data to cold storage.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-193 size-full\" src=\"http:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2019\/11\/changefeedoverview.png\" alt=\"\" width=\"1201\" height=\"712\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2019\/11\/changefeedoverview.png 1201w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2019\/11\/changefeedoverview-300x178.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2019\/11\/changefeedoverview-1024x607.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2019\/11\/changefeedoverview-768x455.png 768w\" sizes=\"(max-width: 1201px) 100vw, 1201px\" \/><\/p>\n<h2><span style=\"font-size: 14pt;\"><strong>How Cassandra API Change Feed support works<\/strong><\/span><\/h2>\n<p>Change Feed in Cassandra uses a pull model in which the Cassandra API maintains a paging state. Cassandra clients can fetch the next batch of changes using a SELECT statement and the previous paging state. The C# snippet below defines a query on the change feed, starting at current datetime:<\/p>\n<pre class=\"theme:github lang:c# decode:true \">DateTime timeBegin = DateTime.UtcNow;\r\nstring time = timeBegin.ToString(\"yyyy-MM-ddTHH:mm:ss.fffZ\", CultureInfo.InvariantCulture);\r\n\r\n\/\/Return the latest change for all rows in 'user' table\r\nIStatement changeFeedQueryStatement = new SimpleStatement(\r\n$\"SELECT * FROM uprofile.user where COSMOS_CHANGEFEED_START_TIME() = '{time}'\");<\/pre>\n<p>The below demo shows the Change Feed being queried iteratively, using the paging state, while another application is writing records to the same table. In each iteration, the query resumes at the last point changes were read. As a result, we see a continuous stream of new changes available on the change feed. You can download the full code sample <a href=\"https:\/\/docs.microsoft.com\/samples\/azure-samples\/azure-cosmos-db-cassandra-change-feed\/cassandra-change-feed\/\">here<\/a>.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-198 size-full\" src=\"http:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2019\/11\/ChangeFeed-1.gif\" alt=\"\" width=\"1908\" height=\"1064\" \/><b><\/b><i><\/i><u><\/u><\/p>\n<p>&nbsp;<\/p>\n<p>The current version of the pull-based change feed model for Cassandra API supports change tracking on either a per logical partition key (primary key) basis, or on the entire container. Please note: for large scale implementations, the use of Change Feed should be run in parallel across partitions.<\/p>\n<p>More changes and enhancements to follow soon!<\/p>\n<h2><span style=\"font-size: 14pt;\"><strong>Get started<\/strong><\/span><\/h2>\n<p>Create a new account using the Azure Portal, ARM template or Azure CLI and connect to it using your favorite tools. We\u2019d love to hear your feedback as well at askcosmosdbcassandra@microsoft.com<\/p>\n<p>Stay up-to-date on the latest Azure\u202f<a href=\"https:\/\/twitter.com\/search?q=%23cosmosdb\">#CosmosDB<\/a>\u202fnews and features by following us on Twitter\u202f<a href=\"https:\/\/twitter.com\/azurecosmosdb\">@AzureCosmosDB<\/a>. We are really excited to see what you will build with Azure Cosmos DB!<\/p>\n<h2><span style=\"font-size: 14pt;\">About Azure Cosmos DB<\/span><\/h2>\n<p><a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/introduction\">Azure Cosmos DB<\/a> is a globally distributed, multi-model database service that enables you to read and write data from any Azure region. It offers <a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/distribute-data-globally\">turnkey global distribution<\/a>, guarantees\u00a0<a href=\"https:\/\/azure.microsoft.com\/support\/legal\/sla\/cosmos-db\/v1_3\/\">single-digit millisecond<\/a> latency at the 99<sup>th<\/sup>\u00a0percentile, 99.999 percent\u00a0<a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/high-availability\">high availability<\/a>, with <a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/scaling-throughput\">elastic scaling<\/a>\u00a0of\u00a0<a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/request-units\">throughput and storage<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure Cosmos DB now has GA support for Change Feed for its Cassandra API. This now allows users of Azure Cosmos DB&#8217;s Cassandra API to get the same great advantages of using Change Feed as enjoyed by users of SQL (Core) API and MongoDB API. What is Change Feed? Azure Cosmos DB&#8217;s Change Feed is [&hellip;]<\/p>\n","protected":false},"author":9387,"featured_media":61,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16,644,19],"tags":[],"class_list":["post-255","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cassandra-api","category-change-feed","category-tips-and-tricks"],"acf":[],"blog_post_summary":"<p>Azure Cosmos DB now has GA support for Change Feed for its Cassandra API. This now allows users of Azure Cosmos DB&#8217;s Cassandra API to get the same great advantages of using Change Feed as enjoyed by users of SQL (Core) API and MongoDB API. What is Change Feed? Azure Cosmos DB&#8217;s Change Feed is [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/9387"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=255"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/61"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}