seninel部署
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # sentinel quarkus adapter
  2. sentinel quarkus adapter provides `sentinel-annotation-quarkus-adapter` and `sentinel-jax-rs-quarkus-adapter` to adapt `sentinel-annotation-cdi-interceptor` and `sentinel-jax-rs-adapter` for quarkus
  3. sentinel quarkus adapter also provides `sentinel-native-image-quarkus-adapter` to support running sentinel with quarkus in native image mode.
  4. To use sentinel-jax-rs-quarkus-adapter, you can simply add the following dependency to your `pom.xml`:
  5. ```xml
  6. <dependency>
  7. <groupId>com.alibaba.csp</groupId>
  8. <artifactId>sentinel-jax-rs-quarkus-adapter</artifactId>
  9. <version>x.y.z</version>
  10. </dependency>
  11. ```
  12. To use sentinel-annotation-quarkus-adapter, you can simply add the following dependency to your `pom.xml`:
  13. ```xml
  14. <dependency>
  15. <groupId>com.alibaba.csp</groupId>
  16. <artifactId>sentinel-annotation-quarkus-adapter</artifactId>
  17. <version>x.y.z</version>
  18. </dependency>
  19. ```
  20. if your quarkus application want to use both `sentinel-annotation-quarkus-adapter` and `sentinel-jax-rs-quarkus-adapter` , then add these two dependency together to your `pom.xml`:
  21. ```xml
  22. <dependency>
  23. <groupId>com.alibaba.csp</groupId>
  24. <artifactId>sentinel-jax-rs-quarkus-adapter</artifactId>
  25. <version>x.y.z</version>
  26. </dependency>
  27. <dependency>
  28. <groupId>com.alibaba.csp</groupId>
  29. <artifactId>sentinel-annotation-quarkus-adapter</artifactId>
  30. <version>x.y.z</version>
  31. </dependency>
  32. ```
  33. when quarkus application started, you can see the enabled feature like:
  34. ```
  35. INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, sentinel-annotation, sentinel-jax-rs]
  36. ```
  37. ## for quarkus native image
  38. if you want to make sentinel with quarkus running in native image mode, you should add the following dependency to your `pom.xml`:
  39. ```xml
  40. <dependency>
  41. <groupId>com.alibaba.csp</groupId>
  42. <artifactId>sentinel-native-image-quarkus-adapter</artifactId>
  43. <version>x.y.z</version>
  44. </dependency>
  45. ```
  46. and then add `--allow-incomplete-classpath` to `quarkus.native.additional-build-args`.
  47. if you use `sentinel-jax-rs-quarkus-adapter` you should set `quarkus.native.auto-service-loader-registration` to true.
  48. you can refer to `sentinel-demo-quarkus`'s `pom.xml` for more details.
  49. when quarkus application started, you can see the enabled feature like:
  50. ```
  51. INFO [io.quarkus] (main) Installed features: [cdi, resteasy, sentinel-annotation, sentinel-jax-rs, sentinel-native-image]
  52. ```
  53. ### notes for limitations
  54. `sentinel-native-image-quarkus-adapter` currently rely on `sentinel-logging-slf4j` to make sentinel run in native image mode easily, because `quarkus-core` provides `Target_org_slf4j_LoggerFactory` to substitue `getLogger` method.
  55. currently `sentinel-transport-simple-http` can work in native image mode, while `sentinel-transport-netty-http` cannot work in native image mode without extra config or substitutions.
  56. ## references for build native image or AOT
  57. - [Quarkus - Tips for writing native applications](https://quarkus.io/guides/writing-native-applications-tips)
  58. - [Quarkus - Class Loading Reference](https://quarkus.io/guides/class-loading-reference)
  59. - [substratevm LIMITATIONS](https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md)
  60. - [Accessing resources in Substrate VM images](https://github.com/oracle/graal/blob/master/substratevm/RESOURCES.md)