Esempio n. 1
0
    public void CreateOrReplaceStream()
    {
        //Arrange
        var creationMetadata = GetEntityCreationMetadata(topicName: "my_movie");

        //Act
        string statement = StatementGenerator.CreateOrReplaceStream <CreateEntityTests.MyMovie>(creationMetadata);

        //Assert
        statement.Should().Be($"CREATE OR REPLACE STREAM{GetExpectedClauses(isTable: false)}");
    }
Esempio n. 2
0
    /// <summary>
    /// Create a new stream or replace an existing one with the specified columns and properties.
    /// </summary>
    /// <typeparam name="T">The type that represents the stream.</typeparam>
    /// <param name="creationMetadata">Stream properties, specify details about your stream by using the WITH clause.</param>
    /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
    /// <returns>Http response object.</returns>
    public Task <HttpResponseMessage> CreateOrReplaceStreamAsync <T>(EntityCreationMetadata creationMetadata, CancellationToken cancellationToken = default)
    {
        if (creationMetadata == null)
        {
            throw new ArgumentNullException(nameof(creationMetadata));
        }

        var ksql = StatementGenerator.CreateOrReplaceStream <T>(creationMetadata);

        return(ExecuteAsync <T>(ksql, cancellationToken));
    }