Surabhi MS
Surabhi MS

Reputation: 31

Conversation state in Microsoft bot framework

I want to know how long a conversation state will be there if we haven't added any expiry method in the bot framework. Did anyone know anything about this?

Upvotes: 0

Views: 409

Answers (1)

Shane Powell
Shane Powell

Reputation: 14138

The short answer is that it's up to you.

Check out the docs for Managing state.

From the docs:

The Bot Framework SDK includes some implementations for the storage layer:

  • Memory storage implements in-memory storage for testing purposes. In-memory data storage is intended for local testing only as this storage is volatile and temporary. The data is cleared each time the bot is restarted.

  • Azure Blob Storage connects to an Azure Blob Storage object database.

  • Azure Cosmos DB partitioned storage connects to a partitioned Cosmos DB NoSQL database.

(although it also states: The Cosmos DB storage class has been deprecated.)

Or you can write your own custom storage.

What your question really comes down to is when does a conversation expire. This can be a function of the bot or the storage layer.

From the conversation expire link above:

  • User Interaction Expiration

This type of expiring conversation is accomplished by adding a last accessed time property to the bot's conversation state. This property value is then compared to the current time within the activity handler before processing activities.

  • Storage Expiration

Cosmos DB provides a Time To Live (TTL) feature that allows you to delete items automatically from a container after a certain time period. This can be configured from within the Azure portal or during container creation (using the language-specific Cosmos DB SDKs).

The Bot Framework SDK doesn't expose a TTL configuration setting. However, container initialization can be overridden and the Cosmos DB SDK can be used to configure TTL prior to Bot Framework storage initialization.

Upvotes: 1

Related Questions