Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ktor 3.0 support #1716

Open
lexa-diky opened this issue Nov 27, 2023 · 19 comments
Open

Ktor 3.0 support #1716

lexa-diky opened this issue Nov 27, 2023 · 19 comments
Assignees
Labels
ktor status:checking currently in analysis - discussion or need more detailed specs type:feature-proposal
Milestone

Comments

@lexa-diky
Copy link

Is your feature request related to a problem? Please describe.
JB recently released Ktor 3.0.0-betta1. Currently Ktor does not support it, JB changed API. In particular access to monitor now done via Application not Environment, maybe there is more incompatibilities.

Describe the solution you'd like
Separate ktor-3 module to have both ktor 2.* and 3.*

Target Koin project
ktor

@Nek-12
Copy link

Nek-12 commented Dec 3, 2023

Can second this, but I would prefer a simple dependency upgrade instead of separate artifact

@Nek-12
Copy link

Nek-12 commented Dec 13, 2023

The workaround for now is to copy everything from the koin Ktor sources and fix the compile time error

@lexa-diky
Copy link
Author

If koin goes with single module approach, it will break comp with ktor-2, and I guess bunch of people will not update for a while

@Nek-12
Copy link

Nek-12 commented Dec 13, 2023

The only updates for the past months have been dependency updates... The whole library is 2 files

@arnaudgiuliani arnaudgiuliani added ktor status:checking currently in analysis - discussion or need more detailed specs type:feature-proposal labels Dec 13, 2023
@arnaudgiuliani arnaudgiuliani self-assigned this Dec 13, 2023
@arnaudgiuliani
Copy link
Member

Yes, great topic coming 👍

@Nek-12
Copy link

Nek-12 commented Dec 25, 2023

Can you please add ktor 3.0 support first before you refactor, add new stuff, and break something with the update you described in your article? @arnaudgiuliani

Changing one line of code, that is, so that we don't wait till Q4 2024 for this to get fixed

@arnaudgiuliani arnaudgiuliani added this to the ktor-3.6.0 milestone Jan 25, 2024
@arnaudgiuliani
Copy link
Member

something I can setup for 3.6.0 - Q1
Seems that we need to separate both ktor & ktor3

@FlyingYu-Z
Copy link

Is there any solution now?

@JoonasC
Copy link

JoonasC commented Jun 29, 2024

@arnaudgiuliani I would appreciate a solution for this, as I am currently unable to use SSE (server sent events) in my application due to it only being supported in Ktor 3.0.0. Let me know if I can speed up the work, maybe by making a PR?

@arnaudgiuliani arnaudgiuliani modified the milestones: ktor-3.6.0, 4.0.0 Jul 24, 2024
@fluxxion82
Copy link

I'm am interested in this as well and will be watching for updates.

@Nek-12
Copy link

Nek-12 commented Aug 2, 2024

@fluxxion82 Just copy all sources of the Ktor module to your project. This hasn't been addressed in almost a year and the author has no intention of doing so.

@KevinMeneses
Copy link

it would be nice to get support for this

@hashir1296
Copy link

Still waiting for this. No solutions of as of yet?

@Nek-12
Copy link

Nek-12 commented Aug 14, 2024

Like I said, just copy and paste all sources of Koin-ktor module into your project and fix the breaking changes. Already using this approach in prod

@hashir1296
Copy link

hashir1296 commented Aug 14, 2024

Like I said, just copy and paste all sources of Koin-ktor module into your project and fix the breaking changes. Already using this approach in prod

Pardon but can you please briefly describe what do you mean by this? Earlier we were using koin as:

install(Koin) {
        slf4jLogger()
        modules(appModule)
    }

How do i migrate from this?

@hashir1296
Copy link

Like I said, just copy and paste all sources of Koin-ktor module into your project and fix the breaking changes. Already using this approach in prod

Pardon but can you please briefly describe what do you mean by this? Earlier we were using koin as:

install(Koin) {
        slf4jLogger()
        modules(appModule)
    }

How do i migrate from this?

Figured it out, basically

  1. Goto this link: https://github.com/InsertKoinIO/koin/tree/main/projects/ktor/koin-ktor
  2. Manually copy/paste all files under koin-ktor package (I copied only KoinPlugin)
  3. In your install block, use your koin plugin instead of ktor's

Warning: This is a workaround, with this:

  1. You will lose out on future Ktor or Koin updates
  2. You’ll need to keep an eye on both the Koin and Ktor projects for official updates that may render this workaround obsolete.

@chrisjenx
Copy link

Yeah this is now broken on ktor 3.x:

java.lang.IncompatibleClassChangeError: Found interface io.ktor.server.routing.Routing, but class was expected
	at org.koin.ktor.ext.RoutingExtKt.getKoin(RoutingExt.kt:74)

Will need a ktor3 package, really the impl is basically the same, but they are incompatible due to changes to classes in ktor3

@chrisjenx
Copy link

PR here: #1978

There is jar with the ktor3 target if you need it for now

@chrisjenx
Copy link

chrisjenx commented Sep 13, 2024

@arnaudgiuliani if no objections, can we fast track to 4.0? Happy to maintain the module if you ping me. (And get in the next RC?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ktor status:checking currently in analysis - discussion or need more detailed specs type:feature-proposal
Projects
None yet
Development

No branches or pull requests

9 participants