Пример #1
0
    public void CreateStream()
    {
        //Arrange
        var creationMetadata = GetEntityCreationMetadata(topicName: "my_movie");

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

        //Assert
        statement.Should().Be($"CREATE STREAM{GetExpectedClauses(isTable: false)}");
    }
Пример #2
0
    /// <summary>
    /// Create a new stream 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="ifNotExists">If the IF NOT EXISTS clause is present, the statement won't fail if a stream with the same name already exists.</param>
    /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
    /// <returns>Http response object.</returns>
    public Task <HttpResponseMessage> CreateStreamAsync <T>(EntityCreationMetadata creationMetadata, bool ifNotExists = false, CancellationToken cancellationToken = default)
    {
        if (creationMetadata == null)
        {
            throw new ArgumentNullException(nameof(creationMetadata));
        }

        var ksql = StatementGenerator.CreateStream <T>(creationMetadata, ifNotExists);

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