close
Skip to content

feat(csharp): add examples for C# SDK#2178

Merged
hubcio merged 20 commits into
apache:masterfrom
sobczal2:cs-sdk-examples
Sep 20, 2025
Merged

feat(csharp): add examples for C# SDK#2178
hubcio merged 20 commits into
apache:masterfrom
sobczal2:cs-sdk-examples

Conversation

@sobczal2
Copy link
Copy Markdown
Contributor

Closes #1891

Summary

This PR adds 4 usage examples, script for running them and updates CI to include that script.

Details

All examples try to mirror existing rust examples. This was possible for:

  • Basic
  • GettingStarted
  • MessageEnvelope
  • MessageHeader

Skipped examples are:

  • multi-tenant - IggyProducer type is not present in C# SDK, so I wasn't able to mirror it, this example is possible with some changes, but I think it is better to do it in a seperate PR, this one is already big
  • new-sdk, sink-data-producer - I believe these are irrelevant, correct me if I'm wrong
  • stream-builder - this can probably be implemented in the future, but there is no such API in C# SDK for now

Should foreign/csharp/Iggy_Sample_Consumer and foreign/csharp/Iggy_Sample_Producer be removed in this PR?

@numinnex
Copy link
Copy Markdown
Contributor

numinnex commented Sep 18, 2025

Left one comment, but LGTM! 😺

numinnex
numinnex previously approved these changes Sep 18, 2025
Comment thread scripts/run-csharp-examples-from-readme.sh
@lukaszzborek
Copy link
Copy Markdown
Contributor

And yes, please remove old example projects from foreign/csharp

@sobczal2
Copy link
Copy Markdown
Contributor Author

Rebased and partially fixed CI, not sure how we want to include examples within .github/actions/csharp-dotnet/pre-merge/action.yml, I would appreciate a suggestion

@apache apache deleted a comment from hubert-laserdata Sep 19, 2025
@hubcio
Copy link
Copy Markdown
Contributor

hubcio commented Sep 19, 2025

@sobczal2, for including the c# examples in this flow you just have to add it to examples suite in components.yml:
image

@sobczal2
Copy link
Copy Markdown
Contributor Author

Hopefully fixed CI issues and added examples to restore, build, lint. Refactored some steps to pass just sln/csproj directory instead of using cd, but I can revert it if you prefer it the other way

Copy link
Copy Markdown
Contributor

@hubcio hubcio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall great job! if possible, please fix these lints

Comment thread .github/actions/csharp-dotnet/pre-merge/action.yml
@hubcio
Copy link
Copy Markdown
Contributor

hubcio commented Sep 19, 2025

Just to add: for now, please ignore failing compat job, it'll be fixed soon :)

@sobczal2
Copy link
Copy Markdown
Contributor Author

sobczal2 commented Sep 19, 2025

scripts/run-csharp-examples-from-readme.sh fails with invalid credentials error, I don't think it is a bug here, I'm also not able to login to iggy locally with iggy-cli after pulling lastest changes

@hubcio
Copy link
Copy Markdown
Contributor

hubcio commented Sep 19, 2025

@sobczal2 yeah, this is on my side, together with @spetz we introduced nasty bug with credentials for CI. working it on right now, will be merged with #2180

after it's merged you can rebase and everything should work

@hubcio
Copy link
Copy Markdown
Contributor

hubcio commented Sep 19, 2025

@sobczal2 recently, we had to introduce a change in which iggy doesn't create root user (iggy) with default password (iggy), but some randomized password.

due to that, if you are starting locally iggy-server via docker i suggest to add IGGY_ROOT_USERNAME=iggy and IGGY_ROOT_PASSWORD=iggy env variables (via docker -e argument)

if you are starting iggy via binary, you can just call target/debug/iggy-server --fresh --with-default-root-credentials

  -f, --fresh
          Remove system path before starting (WARNING: THIS WILL DELETE ALL DATA!)

          This flag will completely remove the system data directory (local_data by default)
          before starting the server. Use this for clean development setups or testing.

          Examples:
            iggy-server --fresh                          # Start with fresh data directory
            iggy-server -f                               # Short form

      --with-default-root-credentials
          Use default root credentials (INSECURE - FOR DEVELOPMENT ONLY!)

          When this flag is set, the root user will be created with username 'iggy'
          and password 'iggy' if it doesn't exist. If the root user already exists,
          this flag has no effect and a warning will be printed.

          This flag is equivalent to setting IGGY_ROOT_USERNAME=iggy and IGGY_ROOT_PASSWORD=iggy,
          but environment variables take precedence over this flag.

          WARNING: This is insecure and should only be used for development and testing!

          Examples:
            iggy-server --with-default-root-credentials     # Use 'iggy/iggy' as root credentials

i rebased your PR, let's see if CI will work

Comment thread scripts/run-csharp-examples-from-readme.sh Outdated
@hubcio
Copy link
Copy Markdown
Contributor

hubcio commented Sep 19, 2025

Have you already joined our discord?

@sobczal2
Copy link
Copy Markdown
Contributor Author

Have you already joined our discord?

Yes :)

@spetz
Copy link
Copy Markdown
Contributor

spetz commented Sep 20, 2025

Thank you, such examples will be very useful for C# devs :)

@hubcio hubcio merged commit a5124c8 into apache:master Sep 20, 2025
47 checks passed
hageshiame pushed a commit to hageshiame/iggy that referenced this pull request Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add C# SDK examples

5 participants