<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Oguzhan Derici on Medium]]></title>
        <description><![CDATA[Stories by Oguzhan Derici on Medium]]></description>
        <link>https://medium.com/@oguzhanderici?source=rss-b897bcd7ed3d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Oguzhan Derici on Medium</title>
            <link>https://medium.com/@oguzhanderici?source=rss-b897bcd7ed3d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:24:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@oguzhanderici/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Rethinking Configuration Management in Microservices: Our Admin CMS Journey]]></title>
            <link>https://medium.com/digigeek/rethinking-configuration-management-in-microservices-our-admin-cms-journey-f73eaf14d418?source=rss-b897bcd7ed3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f73eaf14d418</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[configuration-management]]></category>
            <category><![CDATA[spring-cloud-config]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[system-design-project]]></category>
            <dc:creator><![CDATA[Oguzhan Derici]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 08:00:50 GMT</pubDate>
            <atom:updated>2025-12-22T10:14:31.211Z</atom:updated>
            <content:encoded><![CDATA[<h4>Background: Our CMS Journey</h4><p>Hello everyone, after a long silence, I’d like to greet you with a new journey we are currently part of.</p><p>Today, I’d like to start with the first part of our CMS journey, which will be a multi-part series. We initially had a monolithic application. Naturally 🙂 we moved toward a microservices architecture to make the system more effective, applying DDD principles and modernizing our tech stack at the same time.</p><p>We had a CMS (Content Management System) in our architecture. Within this system, there were two main data domains: Admin CMS and Client CMS.</p><h4>Understanding Admin CMS and Client CMS</h4><p>Admin CMS represents system-level configuration values such as service URLs, credentials, and timeout settings, backed by a database. You can think of these as values typically defined in application.yml.</p><p>Client CMS, on the other hand, represents content lists and page content stored in a SharePoint-based infrastructure. It covers enriched infrastructure data, static content, and page layouts. I’ll talk about the changes we made for Client CMS in the next article 🙂</p><p>Admin CMS had its own Spring MVC application, where configuration values were defined and stored in the database. In the monolithic setup, applications loaded all of these values into their local caches during startup and used them directly. However, once we moved into the microservices world, things started to look a bit different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qUZVtk7ADXIbwf2ZF8CWuQ.png" /><figcaption>Admin Cms Previous Architecture</figcaption></figure><h4>Previous Admin CMS Architecture</h4><p>We first needed to segment the configurations used in Admin CMS. We placed static connection configurations — such as microservice URLs, database, Redis, and Kafka endpoints — into OpenShift ConfigMaps so that all services could share them. For microservice-specific configuration cases, we relied on environment-based overrides. Infrastructure credentials (DB, Kafka, Redis) were stored securely in OpenShift Secrets. Critical credentials used for external system integrations were stored in the Admin CMS database using a custom encryption mechanism.</p><p>With this approach, we positioned each configuration type in the right place: static and heavy configs in ConfigMaps, infrastructure credentials in Secrets, and dynamically changing external system credentials — encrypted — in the Admin CMS database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*U4AonCOJI30MB8I5GGhFjQ.png" /><figcaption>Config Seperations</figcaption></figure><h4>Redis-Based CMS Distribution Layer</h4><p>We used this structure throughout the monolith-to-microservices transition, but with some differences. First, we developed a microservice called cms-data. This service fetched values from the Admin CMS database and wrote them to Redis. Once the values were stored in Redis, we published an event via Redis Pub/Sub on the admin-cms-topic.</p><p>When our microservices started up, they loaded Admin CMS data into their local caches. In addition, whenever they were triggered through the admin-cms-topic channel they subscribed to in Redis, they refreshed their local caches.</p><p>To handle fetching Admin CMS keys from Redis, type conversions, refresh logic, and other related capabilities, we built a configuration-manager library. Instead of duplicating this logic, all microservices consumed it through this shared library. However, even with this library in place, the system still had several drawbacks.</p><h4>Drawbacks of the Previous Approach</h4><ul><li>All configuration keys were loaded into local caches regardless of usage</li><li>Scheduled Redis fetch operations introduced additional overhead</li><li>Increased Redis I/O during refresh cycles</li><li>Higher memory consumption due to unused cached values</li><li>Additional maintenance cost for a custom library</li><li>Service-level dependencies on the shared configuration library</li><li>Reliance on Redis Pub/Sub for config update notifications</li></ul><h4>Why We Decided to Redesign</h4><p>Although the system worked effectively, it still required significant maintenance effort. For this reason, we decided to redesign the system to better support future needs and different infrastructure environments. As part of this redesign, we moved to Spring Cloud Config Server to simplify how configuration keys are retrieved and distributed to services.</p><p>We needed to preserve the existing database consistency and auditing mechanisms in our system, which is why storing configurations in tools such as Git, Stash, Vault, or Helm was not a suitable option for us. Similar solutions can certainly be built using systems like Vault, Helm, or AppConfig; however, in this article, we focus on an architecture that fits our own domain and operational requirements, and we evaluate our decisions within that context.</p><p>Moving all configurations into ConfigMaps would have introduced significant service-level update overhead and operational cost, so we decided to continue using the database. As part of this approach, we added a new column to the database to indicate which microservices use each configuration key.</p><h4>New Admin CMS Architecture</h4><p>With this approach, we could clearly see where each configuration key was used from a management perspective, while our Cloud Config clients would only fetch the keys relevant to them. At the same time, we started to clearly define our configuration types: those that can change dynamically and those that require a restart when updated.</p><p>This allowed us to refresh beans annotated with @RefreshScope on the fly, while keeping beans that should remain static outside the refresh scope—effectively eliminating unnecessary restart costs for critical components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUyNPrzaJIe1rVzwp8Bkbw.png" /><figcaption>Admin Cms New Architecture</figcaption></figure><h4>Cloud Config Server UI and Selective Refresh</h4><p>We developed a new UI and service for our Cloud Config Server so that AO contacts could manage configuration keys through this interface. When an update was made, the UI triggered the Config Server actuator, and configuration change events were propagated to microservices via Spring Cloud Kafka Bus, allowing each pod to fetch its updated keys.</p><p>However, not every service needs to refresh its configuration on every change. For this reason, we enhanced the UI with an additional trigger API that allows updates to be propagated only to the relevant microservices through Kafka Bus.</p><h4>What We Achieved with the New Design</h4><ul><li>Removed Redis-based CRUD operations for Admin CMS data</li><li>Eliminated scheduled config refresh jobs</li><li>Reduced Redis data footprint</li><li>Removed custom library maintenance overhead</li><li>Replaced library-based configuration access with native Spring @Value usage</li><li>Detected missing configuration issues during startup rather than runtime</li><li>Reduced unnecessary in-service data and related load</li><li>Removed Redis Pub/Sub dependency for Admin CMS updates</li></ul><h4>Bootstrap Configuration</h4><p>We added the SQL query and related configuration details for our Cloud Config Server to the bootstrap.yml file below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e2c8aa461f716796214745c1f2cb58f/href">https://medium.com/media/7e2c8aa461f716796214745c1f2cb58f/href</a></iframe><p>To allow microservices to fetch configuration values during startup, we defined the bootstrap.yml file as shown below.</p><h4>Refresh Scope Test Scenario</h4><p>When adding Spring Cloud Config Server, our biggest concern was the runtime performance of beans managed with @RefreshScope. To evaluate this, we designed a load test to observe the behavior of refreshable beans.<br>During the test, we continuously sent requests to five @RefreshScope-annotated APIs for 30 seconds. At the 15th second, a refresh event was triggered through Kafka Bus, recreating the refresh-scoped beans. The graphs below illustrate the request latencies observed during the test</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZpE3Hay-OOO1Q4kY8x1ofw.png" /><figcaption>Local Refresh Scope Changes</figcaption></figure><p>We evaluated two different scenarios by running the test both locally and in the test environment. In the test setup, actuator probes and monitoring tools were actively enabled on the deployed microservice pod. We also used lower RAM and CPU limits compared to the local environment to observe the impact of bean refresh operations under worst-case conditions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BseLqkWU3lPMtJ3ya-bLug.png" /><figcaption>Test environment Refresh Scope Changes</figcaption></figure><p>Especially in the test environment, we ran these requests using minimal system resources comparable to our local and production setups. As a result, the overall cost of bean updates performed via @RefreshScope turned out to be 2–3 times lower than restarting the entire service.</p><p>For this reason, we created a balanced setup by placing only truly dynamic beans inside the refresh scope, while keeping critical beans static. These tests clearly showed that @RefreshScope should not be used randomly, but rather in a conscious and limited manner.</p><h4>Conclusion</h4><p>This journey was not just about replacing one technology with another, but about <strong>rethinking how configuration should be managed in a microservices architecture</strong>.</p><p>By moving away from Redis-based distribution and library-heavy solutions, and adopting Spring Cloud Config Server with a clear separation of responsibilities, we were able to:</p><ul><li>Simplify configuration distribution across microservices</li><li>Remove Redis Pub/Sub and scheduled refresh overhead</li><li>Eliminate custom library maintenance and service-level coupling</li><li>Detect configuration issues early during application startup</li><li>Reduce memory usage and unnecessary in-service data</li><li>Clearly separate static, infrastructure, and dynamic configurations</li></ul><p>Most importantly, we validated our design decisions with real measurements. The RefreshScope load tests showed that <strong>controlled, limited, and conscious use of dynamic configuration updates</strong> provides a much better balance than full service restarts, without introducing instability.</p><p>This was the first step of our CMS transformation journey, focused on <strong>Admin CMS and configuration management</strong>. In the next article, I’ll dive into the <strong>Client CMS side</strong> and share how we redesigned our SharePoint-based content pipelines and caching strategies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f73eaf14d418" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digigeek/rethinking-configuration-management-in-microservices-our-admin-cms-journey-f73eaf14d418">Rethinking Configuration Management in Microservices: Our Admin CMS Journey</a> was originally published in <a href="https://medium.com/digigeek">DigiGeek</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing JWT Management with Configurable Spring Cloud Gateway for Multi-Application Ecosystems]]></title>
            <link>https://oguzhanderici.medium.com/enhancing-jwt-management-with-configurable-spring-cloud-gateway-for-multi-application-ecosystems-7531dee43c65?source=rss-b897bcd7ed3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7531dee43c65</guid>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring-cloud-gateway]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[efficiency]]></category>
            <dc:creator><![CDATA[Oguzhan Derici]]></dc:creator>
            <pubDate>Tue, 31 Dec 2024 15:36:25 GMT</pubDate>
            <atom:updated>2024-12-31T15:36:25.838Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone,</p><p>Today, I would like to present an overview of our Spring Cloud Gateway solution, designed to handle enhanced JWT-based authentication for different client applications within our ecosystem.</p><p>In our department, we manage a variety of mobile and web applications that serve distinct content to our customers. Each application has its own unique architecture, business logic, and user experience, yet they all rely on a shared OpenShift platform. This unified infrastructure allows us to streamline the management of microservices, as their needs and interdependencies are common across applications.</p><p>However, each of these applications employs a different token or session management system, which introduces a need for a flexible and secure way to handle authentication. By leveraging an enhanced JWT structure in conjunction with a highly configurable Spring Cloud Gateway, we have been able to implement a solution that operates from a single repository but supports multiple, distinct deployments for each application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ia-X-TT0lcy7ArqI" /><figcaption>Overall Design of System</figcaption></figure><p>As you know, in microservice architecture, API Gateway is the crucial component for the system as an entry point of the services and decides that client requests will pass through or block to where.</p><p>Spring Cloud Gateway features:</p><ul><li>Built on Spring Framework and Spring Boot</li><li>Able to match routes on any request attribute.</li><li>Predicates and filters are specific to routes.</li><li>Circuit Breaker integration.</li><li>Spring Cloud DiscoveryClient integration</li><li>Easy to write Predicates and Filters</li><li>Request Rate Limiting</li><li>Path Rewriting</li></ul><p><a href="https://spring.io/projects/spring-cloud-gateway#overview">Spring Cloud Gateway</a></p><p>Spring Cloud Gateway can also handle Authentication and Authorization by integrating Spring Security. In this scenario, we will focus on JWT based authentication.</p><p><a href="https://jwt.io/introduction">JSON Web Token Introduction - jwt.io</a></p><p>In our microservice architecture, the JWT payload serves as a container for claims about the user, and it can also hold additional metadata that is crucial for service interactions. For example, information such as <strong>email</strong>, <strong>channel type</strong>, <strong>language</strong>, <strong>operating system version</strong>, and <strong>application version</strong> is critical not only for logging purposes but also for its usage in the service layer. This data plays an essential role in the proper functioning of our services and can be transmitted in various forms, including the request body or request parameters.</p><p>However, sending this information through traditional methods — such as request parameters — can be risky. It introduces the potential for <strong>data manipulation</strong>, which could compromise the integrity of the service request. Furthermore, missing or incorrect data could lead to unexpected behavior or errors.</p><p>To address these concerns, we embed this critical information directly in the <strong>JWT payload</strong>. By doing so, we ensure that the data is securely packaged along with the authentication token, reducing the risk of manipulation. When the JWT is extracted during the request handling process, the necessary information is then added to the request headers before the request is routed to the corresponding microservices.</p><p>Each microservice, upon receiving the request, utilizes the information in the headers through <strong>MDC (Mapped Diagnostic Context)</strong> for consistent logging and contextual data processing. This ensures that all services have access to the relevant user and environmental data without exposing it through less secure channels.</p><p>For more detailed information about our logging system and MDC integration, please refer to the related post.</p><p><a href="https://medium.com/digigeek/deepdive-logging-journey-with-spring-logback-and-mdc-a61637fd6657">DeepDive Logging Journey with Spring, Logback and MDC</a></p><p>According to different cases for both logged-in and non-logged-in scenarios, we have several filters for flexibility. These filters are used for controlling requests before routing to microservices via yaml configurations.</p><p>Before going deep dive to implementation, I have to mention our login process. Login process is completed by another department and we do not have any user table or data for email, password and any other informations. When clients login to system, SDK give them to one time token and client sends it to our login service. By verifying token and getting some data from another infrastructure services we collect user informations and never store it permanently. However, this approach give us a big drawback as session based services in everywhere.</p><p>To eliminate this problem, we embed necessary data to JWT and use it in microservices via headers. As a result of this approach, any microservices API can be work without login or session processes by Open API screens or Postman.</p><p>Dependencies</p><pre>dependencies {<br>    implementation &#39;org.springframework.boot:spring-boot-starter-actuator&#39;<br>    implementation &#39;org.springframework.boot:spring-boot-starter-webflux&#39;<br>    implementation &#39;org.springframework.cloud:spring-cloud-starter-gateway&#39;<br>    implementation &#39;io.jsonwebtoken:jjwt-api:0.11.5&#39;<br>    implementation &#39;io.jsonwebtoken:jjwt-impl:0.11.5&#39;<br>    implementation &#39;io.jsonwebtoken:jjwt-jackson:0.11.5&#39;<br>}</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93df7808f4d2cab6ab471c71f240c379/href">https://medium.com/media/93df7808f4d2cab6ab471c71f240c379/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fce79362c6cec3fae827a7ef217d2fcf/href">https://medium.com/media/fce79362c6cec3fae827a7ef217d2fcf/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f67f2691b1db184674a7aeb23826178/href">https://medium.com/media/7f67f2691b1db184674a7aeb23826178/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70d16276583d95df46ccdee654645073/href">https://medium.com/media/70d16276583d95df46ccdee654645073/href</a></iframe><p>Default Filter class reorganizes API headers for both logged-in and non-logged-in cases by adding ip, port, uri, method and channel informations. As you can see in application.yml file, Authentication filter takes turn. By using JWT implementation, authentication filter takes necessary information from payload and put them both MDC and request headers before sending them to related microservices.</p><p>We have different JWT keys for every different applications. These configurations are injected by conditionalOnProperty annotations in implementation layer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba149374fadc8f978ff39874bb0e1a1b/href">https://medium.com/media/ba149374fadc8f978ff39874bb0e1a1b/href</a></iframe><p>By using conditionalOnProperty key based on yml file, we implemented different signature keys and sizes as dependency to JwtService. Thus, without implementing any qualifier service for JWT logic, we can easily use it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3f613bb05c1588519fbf7e4ca68b4aa/href">https://medium.com/media/b3f613bb05c1588519fbf7e4ca68b4aa/href</a></iframe><p>In summary, our Spring Cloud Gateway solution, combined with enhanced JWT management, provides a flexible, secure, and scalable architecture for handling authentication across a variety of applications within our ecosystem. By embedding essential user and contextual data directly into the JWT payload, we eliminate the need for traditional session-based systems, reducing security risks associated with data manipulation. The use of configurable filters for both logged-in and non-logged-in scenarios ensures that requests are handled efficiently and securely, while the integration of MDC for consistent logging across microservices enhances traceability and monitoring. With support for multiple JWT keys and signatures tailored to different applications, our approach allows seamless customization without the need for complex service logic, simplifying the management of authentication across diverse systems. This solution significantly improves both the security and operational efficiency of our multi-application ecosystem.</p><p>#happyCoding :))</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7531dee43c65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DeepDive Logging Journey with Spring, Logback and MDC]]></title>
            <link>https://medium.com/digigeek/deepdive-logging-journey-with-spring-logback-and-mdc-a61637fd6657?source=rss-b897bcd7ed3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a61637fd6657</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[micrometer]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[slf4j]]></category>
            <dc:creator><![CDATA[Oguzhan Derici]]></dc:creator>
            <pubDate>Wed, 13 Dec 2023 12:01:36 GMT</pubDate>
            <atom:updated>2023-12-13T12:01:36.102Z</atom:updated>
            <content:encoded><![CDATA[<p>Today I would like to describe one of the annoying problem of microservice architecure which is called as Logging. Before explaining our new solution LogCave, I have to tell legacy logging system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*lgqDJZOT6Epljb7r.jpg" /><figcaption>LogCave is inspired by Bat cave</figcaption></figure><p>We have two types of logging infrastructure. Both of them requires some user specific data to put these on log information such as email, client version, app version, channel, ip-port and etc. For carrying all these data to every services, we have a threadLocal approach. Then log or report log functions, take this data and sent logs to relevant flows.</p><pre>INFO;2023-12-02 13:27:26;IPHONE;TR;null;oguzderici@test.com;111.258.11.369:1202;;;;;requestURI:/test-log;rdsId:RDS:20231121132724_XYZASDFGHJKL;;113;;ProcessTime=113</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7HUZv_gLk8c_Incv" /><figcaption>Log Infrastructure</figcaption></figure><p>First one is console logging, custom functions above of Slf4j, take data from threadLocal and prepare log messages. In our both cases log pattern is hard to understand, it combines all threadLocal data and log messages with semicolon “;”. Thus, when you need to search anything from elastic via kibana you have to write message: “related-email” and message: “related-client-version” and so on.</p><p>This approach prevents to use power of elasticsearch infrastructure because every search criteria combined in message. As a result of this, there is very log process time to understand which data is following. Also, messages could be taken wrong by newbies. I should give an example for this, imagine, you will pay bills.</p><ol><li>As a logged in user, you can make operation for yourself.</li><li>As a nonlogin user, you can make operation for yourself.</li><li>An another user can make operation for yourself.</li></ol><p>All 3 cases can be operated in the same hour. When you want to search log and just write message : “email”, all footprints will be shown. But which one is related to logged in user ? Then you should filter sender IP and process goes on. Elasticsearch process time, log diversion and any other filter you want to apply will take long process. Sounds bad right :(</p><p>Anyway, other logging mechanisms is reporting log. Reporting log take data with additional information and send them to database. Additional information are not included on console logging and ReportDTO is used for them. Report log is also on elastic, so we can search it via kibana. However, report logs are sent via Kafka to database with KafkaConnectors. To send every custom report message there is an interface. Like console logging these additonal informations combined with semicolon. Every semicolon represents different database field, so we have to be careful when writing a message.</p><blockquote>Ooops, should I count semicolons as uno dos tres, or write a custom function</blockquote><p>When we convert our legacy system to microservice architecture, we cannot destroy this infrastructure at the beginning and carry on with this. However, in microservice report logging we did not use kafka connector database approach, so we code reporting service to consume data and write it on database.</p><p>In microservice console logging, we had a log library to carry on data as our legacy logging. But in microservices, we have lots of implementation, and carry all common data to microservices in header with interceptors. Still we have lots of boilerplate code and copy paste logic. But we have to demolish it.</p><p>After long and several negotiations with operations, QA and data analysts, we started to design logging system from scratch. First we change semicolon appender base approach from microservice logging and take some data outside of message. That means we have new fields on elastic such as email, clientIp, clientVersion, language and etc. As a result of this, we can make explicit search on kibana like email:””, and language:”” … This gives better result and search time. To accomplish that, we make our logback file with related fields.</p><p>Then, we need to carry all these common information between microservices. We do not want to use interceptors because lack of implementation can cause wrong log messages. We use micrometer baggages to carry data. All common headers between microservices are carry on baggage fields. With the power of MDC, we put our common headers to console logging with logback file with 0 effort.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/080ac2233481c68762758d74e629afa9/href">https://medium.com/media/080ac2233481c68762758d74e629afa9/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9cc3150e07825553ec07ba44a3d32df/href">https://medium.com/media/f9cc3150e07825553ec07ba44a3d32df/href</a></iframe><p>While we are using MDC, we need to add some additional fields to facilitate tracking such as requestUri, requestMethod, and operation start time. Herewith, fields are set to MDC when request reach to service.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50b45382f68d6adcca21e0706c9d4d90/href">https://medium.com/media/50b45382f68d6adcca21e0706c9d4d90/href</a></iframe><p>We are very glad to get rid of console logging old approach. There is no other dependency injection for console logging anymore. We just code log.info(“our message”) and just complete everything.</p><p>Lets take care of report logging. Ok we have new fields on elastic for console logging and we carry these with micrometer, first, we need to extract these common fields from ReportDTO. While we are ready to start demolishing report logging, lets make it Json Based. But we still add reportLogger to services as dependency.</p><p>After a some searches, we customize our kafka appender to send logs. On logback file we add kafka appender and logback configuration. ReportService static functions are coded to use new kafkaAppender logger on system. We still use Slf4j logger but when we call function, logs are both on console and produce on Kafka.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5460785041adcc6a808c84e235f33168/href">https://medium.com/media/5460785041adcc6a808c84e235f33168/href</a></iframe><p>Extracted DTO is sent on message, so we need to change our reporting service (report consumer service). By using mapper functionaly of mapstruct, we combine appender common headers data and reportDTO to reportEntity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d311610c5ed5a1598cdb9d63747fe16/href">https://medium.com/media/0d311610c5ed5a1598cdb9d63747fe16/href</a></iframe><p>We can use ReportLogService very easily when we compare with our old fashion logger system. Also, in our some cases, we coded an annotation to simplify report log in business logic or service error exception cases. As a result of this, there is no need to write try catch blocks in business layer.</p><pre>{<br>  &quot;_index&quot;: &quot;OD_digitalchannels-202312&quot;,<br>  &quot;_type&quot;: &quot;_doc&quot;,<br>  &quot;_id&quot;: &quot;12121211-db72-ae5a-2125-fgfdghdad&quot;,<br>  &quot;_version&quot;: 1,<br>  &quot;_score&quot;: null,<br>  &quot;_source&quot;: {<br>    &quot;@timestamp&quot;: &quot;2023-12-12T09:00:03.614Z&quot;,<br>    &quot;date_time&quot;: &quot;2023-12-12T12:00:03.513+03&quot;,<br>    &quot;level&quot;: &quot;INFO&quot;,<br>    &quot;traceId&quot;: &quot;f8b6c1f011046f43&quot;,<br>    &quot;spanId&quot;: &quot;73a42d369f2c70ef&quot;,<br>    &quot;email&quot;: &quot;oguzderici@test.com&quot;,<br>    &quot;clientIp&quot;: &quot;1.1.1.1&quot;,<br>    &quot;clientPort&quot;: &quot;30&quot;,<br>    &quot;request-method&quot;: &quot;GET&quot;,<br>    &quot;request-uri&quot;: &quot;/credit-cards&quot;,<br>    &quot;sessionId&quot;: &quot;OD:RDS:20231212115321_DEAA48BADCB3323231&quot;,<br>    &quot;channel&quot;: &quot;NATIVE&quot;,<br>    &quot;channelType&quot;: &quot;IOS&quot;,<br>    &quot;language&quot;: &quot;TR&quot;,<br>    &quot;appVersion&quot;: &quot;18.2.0&quot;,<br>    &quot;osVersion&quot;: &quot;&quot;,<br>    &quot;source&quot;: &quot;kafkaLogger:9&quot;,<br>    &quot;message&quot;: &quot;{\&quot;reportStatus\&quot;:\&quot;SUCCESS\&quot;,\&quot;categoryType\&quot;:\&quot;OD\&quot;,\&quot;actionId\&quot;:\&quot;credit.card\&quot;,\&quot;productId\&quot;:\&quot;\&quot;,\&quot;failReason\&quot;:\&quot;\&quot;,\&quot;failReasonCode\&quot;:\&quot;\&quot;,\&quot;businessFailReason\&quot;:\&quot;\&quot;,<br>\&quot;information\&quot;:\&quot;Credit cards list operation\&quot;,\&quot;catalogId\&quot;:\&quot;\&quot;,\&quot;customerNo\&quot;:\&quot;111111\&quot;,\&quot;orderId\&quot;:\&quot;DD-27\&quot;,\&quot;orderPaymentType\&quot;:\&quot;\&quot;,\&quot;accountId\&quot;:\&quot;125110\&quot;,\&quot;duration\&quot;:\&quot;3\&quot;,\&quot;operator\&quot;:\&quot;Turkcell\&quot;,\&quot;type\&quot;:\&quot;\&quot;}&quot;,<br>    &quot;service_name&quot;: &quot;dc-payment-service&quot;,<br>    &quot;hostname&quot;: &quot;dc-payment-service-121-dcx5rdx&quot;,<br>    &quot;kube_pod&quot;: &quot;dc-payment-service-121-dcx5rdx&quot;,<br>    &quot;kube_namespace&quot;: &quot;digitalchannels&quot;<br>  },<br>  &quot;fields&quot;: {<br>    &quot;date_time&quot;: [<br>      &quot;2023-12-12T09:00:03.513Z&quot;<br>    ]<br>  },<br>  &quot;highlight&quot;: {<br>    &quot;service_name&quot;: [<br>      &quot;@kibana-highlighted-field@dc-payment-service@/kibana-highlighted-field@&quot;<br>    ],<br>    &quot;source&quot;: [<br>      &quot;@kibana-highlighted-field@kafkaLogger:9@/kibana-highlighted-field@&quot;<br>    ]<br>  },<br>  &quot;sort&quot;: [<br>    1702371603513<br>  ]<br>}</pre><p>To summarize, our logging journey is one of the important milestone because, elasticsearch operations have both accelerated and improved with its understandability and new structure. Also, with easy log functionality, development time has accelerated. Let’s take a break and grab a coffee. Happy coding …</p><p>References</p><p><a href="https://www.baeldung.com/mdc-in-log4j-2-logback">https://www.baeldung.com/mdc-in-log4j-2-logback</a></p><p><a href="https://www.baeldung.com/spring-boot-logging">https://www.baeldung.com/spring-boot-logging</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a61637fd6657" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digigeek/deepdive-logging-journey-with-spring-logback-and-mdc-a61637fd6657">DeepDive Logging Journey with Spring, Logback and MDC</a> was originally published in <a href="https://medium.com/digigeek">DigiGeek</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic mapping with MapStruct]]></title>
            <link>https://oguzhanderici.medium.com/dynamic-mapping-with-mapstruct-d8bd04f72b50?source=rss-b897bcd7ed3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8bd04f72b50</guid>
            <dc:creator><![CDATA[Oguzhan Derici]]></dc:creator>
            <pubDate>Sat, 31 Dec 2022 17:44:47 GMT</pubDate>
            <atom:updated>2022-12-31T17:44:47.799Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi all,</p><p>In this article, I would like to talk about how we manage field, property, descriptions on the screens for combination of different client types (web, mobile, app) and language options.</p><p>In our system, we have solution for content management. About this solution, we can configure page labels, titles, detail descriptions for different client type with using language support. I will mention, how we implement these approach with MapStruct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JGCRMyXcV5yKmC8c" /><figcaption>Structure</figcaption></figure><p>Our content management services include multiple page managers<br>with specializations such as property, label, and error messages. Every field has paramaters like client type, language and etc. Thus, when you want to get pagelabel, you should request for related function with pagemanager, channel, language, and fieldname parameters. After these complete business logic, DTO will be enriched with content.</p><p>In the first phase, we created abstract mapstruct mapper and autowire our content management service in it. When we need content from page manager, we imported it via expression. Other fields will be mapped with DTO</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42cb26a1b264048643d9c25c2dddffea/href">https://medium.com/media/42cb26a1b264048643d9c25c2dddffea/href</a></iframe><p>As you can see, we added some parameters as context to our function to use them in expression. Not only adding these parameters in mapper but also using any other business logic can cause problem to pass these data to every function because some of the functions are not use directly in itself, they just passing into inner function.</p><p>To solve passing client relevant data to passing them in functions or services, we follow this approach. https://dzone.com/articles/an-alternative-approach-to-threadlocal-using-sprin-1</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b06c6bd143ec005006452b5c5f63dfbb/href">https://medium.com/media/b06c6bd143ec005006452b5c5f63dfbb/href</a></iframe><p>We fill UserContext with filter and its scope is prototype. Thus, in every request, we generate specific context.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df0ec4fc1dbe99e4cdf193f218a53020/href">https://medium.com/media/df0ec4fc1dbe99e4cdf193f218a53020/href</a></iframe><p>In microservice communications, we are currently using OpenFeign, we added as requestInterceptor to add these context details in every request. As a result of this, we eliminate this requirements of adding context headers manually</p><p>After implementing UserContext and autowire it in Content Management Service, we do not need to pass parameters like language, channel and etc to functions or services. Thus, we edit our mapper.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21eddb0cd6f1c99501c8b9511f3f277e/href">https://medium.com/media/21eddb0cd6f1c99501c8b9511f3f277e/href</a></iframe><p>As a result of this development, we got rid of passing data to inner functions as parameter and give our mapper service to ability of getting content based on language, client type per request. But please be careful on working multi thread :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8bd04f72b50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Different Redis Usage Scenarios in our MicroService Architecture]]></title>
            <link>https://oguzhanderici.medium.com/different-redis-usage-scenarios-in-our-system-e20656a12492?source=rss-b897bcd7ed3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e20656a12492</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[stream]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[cache]]></category>
            <dc:creator><![CDATA[Oguzhan Derici]]></dc:creator>
            <pubDate>Sat, 31 Dec 2022 17:44:17 GMT</pubDate>
            <atom:updated>2023-01-04T09:08:51.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JE28F3Q5YLjfydEESSlriA.png" /></figure><p>Hello everyone,</p><p>In this story, I’m going to describe how we use Redis in our system by giving five different approach. Before that, let me give a brief introduction of the system.</p><p>At the beginning of the division of our monolith legacy system, of course, we followed Domain Driven Design principles. When we dive into technical dept, we saw some boilerplate usage on local caching and sharing data in every instance. Caching and sticky session might be potential problem on microservice transformation.</p><h4>1. Redis Crud Repository</h4><p>On local cache, we have some contents such as page label, property, error message detail and any other details for almost 100 pages. In every instance, local cache is refreshed for every page. However, adding 100 pages in every microservice are not necessary. Some of microservices need maybe 20 or just 1 according to its domain.</p><p>To manage these page informations, we developed one microservice application to retrieve page contents, check updates, push data into Redis and notify other microservices on some of pages are refreshed. To do this, first, entity was generated. In this class, TypeAlias was used for eliminating path conflict on package folder in other microservices.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba9b48b355f042987b625ad0fa060a19/href">https://medium.com/media/ba9b48b355f042987b625ad0fa060a19/href</a></iframe><p>And repository class is generated</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0220120fcb80f5671ec1e442257c257/href">https://medium.com/media/c0220120fcb80f5671ec1e442257c257/href</a></iframe><p>After retrieving Page Contents from the service, operations of page update were completed by using RedisPageManagerRepository.</p><h4>2. Redis Pub/Sub</h4><p>First approach was completed, but now we want to notify other microservices to retrieve updated content on their local cache because of avoiding Redis I/O cost in every request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQ-JHVAr7MQvJEz0ao1VFg.png" /></figure><p>We could use Kafka, but as you know, Kafka works on consumer group and we did not want to break this functionality and duplicate event based operations in every pod. So, we prefer to use Redis Pub/Sub. It works on fire and forget and also, we can notify every subscribers on channel.</p><p>At configuration, we add channelTopic</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa12cecd4ab6c435b655355c7b6c2ec0/href">https://medium.com/media/fa12cecd4ab6c435b655355c7b6c2ec0/href</a></iframe><p>In Publisher Service, updated Page List comes from in section 1 and we published data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9def6d5f26c1aa9ac5e446e8737c1b3e/href">https://medium.com/media/9def6d5f26c1aa9ac5e446e8737c1b3e/href</a></iframe><p>On Consumer side</p><p>Configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3398327cb49947867dc7ddbf31eed072/href">https://medium.com/media/3398327cb49947867dc7ddbf31eed072/href</a></iframe><p>You can also make your listener a service and add dependency. It’s totally up to your architecture. In our case, we transform listener as a service and update our data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a39a79694f41af40f0a3d4b65f524236/href">https://medium.com/media/a39a79694f41af40f0a3d4b65f524236/href</a></iframe><p>Thus, 2 different Redis usage was completed in one scenario.</p><h4>3. RedisTemplate</h4><p>In our domain and business, we need to store some data in microservices. But we do not want to create bunch of data per session and they will be totally independent. According to data and domain, we need different requirements for time-to-live, mobile, web and app session and BFF approach.</p><p>For example, you make a request from mobile application and retrieve data from X microservice by the way X microservice’s data is rarely updated. This data is stored in Redis’ special key. Thus, as same user if you send a same request from web, X microservice returns same data from Redis. As a result of this, you do not need to complete same business logic.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/903cc3f42d4e0098c551d4e03046d3fb/href">https://medium.com/media/903cc3f42d4e0098c551d4e03046d3fb/href</a></iframe><p>The main reason why we use RedisTemplate in this case is controlling and manipulating data per domain. Any type of data can be stored in Redis with different expire time range.</p><h4>4. Redis Cacheable</h4><p>So far, everything is fine in our microservices. However, we need to increase our ability to work with non-user based cache values. So we use RedisCacheManager to store data in Redis by using Spring Cacheable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8ad449e5a3cbb3685fa03f6e42216ab/href">https://medium.com/media/c8ad449e5a3cbb3685fa03f6e42216ab/href</a></iframe><p>We have already used local cache to store some data in every microservice, so added Primary annotation to it. To utilize power of Redis Cacheable, we should use CacheConfig annotation to indicate which cache will be used. With the contribution of this approach, we can easily cache non-user based cache data without using RedisTemplate.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d08ed44387b837cb8c49556a2429c1b/href">https://medium.com/media/0d08ed44387b837cb8c49556a2429c1b/href</a></iframe><h4>5. Redis Stream</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*3wY6zyTni7FKdCAeV33Z1A.png" /></figure><p>In last case, I will mention Stream Redis. When Redis Pub/Sub or Kafka is used, main approaches notify other services and then lost published information which is fire and forget. Because of these infrastructure, some of problems can be occurred such as down of services and loss data on some subscriber or application.</p><p>With Redis Stream, you can track this data. Let’s assume you have a application and you want to catch user behavior on your system for example people read some magazines or news on your app. At first you save data, then maybe run the job and analyze the user and give feedback on new access. By using Redis Stream, real time data process with stream data.</p><p>Let’s reorganize above case. User read magazine and magazine detail for user is published as stream. Recommendation engine on consumer side listen event and analyze it, finally give recommendation on session. You can also follow this approach with Kafka, but Redis Stream keeps stream data till consumer side give acknowledgement and also you cannot miss data for user history. After that, when user interact with different page, your recommendation shows up.</p><p>Let’s dive into code :)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1256b73deda8ba4d8d7eeca432879a6d/href">https://medium.com/media/1256b73deda8ba4d8d7eeca432879a6d/href</a></iframe><p>Publisher service</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/100fe29383fafa28a88f107ad37492ab/href">https://medium.com/media/100fe29383fafa28a88f107ad37492ab/href</a></iframe><p>Consumer Side</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d35575cc70b558553839d24466010b5e/href">https://medium.com/media/d35575cc70b558553839d24466010b5e/href</a></iframe><p>Service Logic</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/118cb87ae2ebfd4dc952ba7f069a2da2/href">https://medium.com/media/118cb87ae2ebfd4dc952ba7f069a2da2/href</a></iframe><p>Whether error shows up in process, there is nothing worry about. You can check pending messages with</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/796fb91966d0363316f3b996040fab1b/href">https://medium.com/media/796fb91966d0363316f3b996040fab1b/href</a></iframe><p>In this story, I tried to mention 5 different usage of Redis in application. I hope it will be helpful. If you like story please CLAP :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e20656a12492" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot Microservices communication with Retrofit]]></title>
            <link>https://oguzhanderici.medium.com/spring-boot-microservices-communication-with-retrofit-4cd4445b001a?source=rss-b897bcd7ed3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cd4445b001a</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[retrofit]]></category>
            <category><![CDATA[openfeign]]></category>
            <dc:creator><![CDATA[Oguzhan Derici]]></dc:creator>
            <pubDate>Tue, 27 Dec 2022 09:27:32 GMT</pubDate>
            <atom:updated>2022-12-27T09:34:43.803Z</atom:updated>
            <content:encoded><![CDATA[<h3>Spring Boot Microservices Communication with Retrofit</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QBUNWt0BOo-4ap65Gp9Nnw.png" /></figure><p>Hi all,</p><p>In my first article, I would like to talk about Retrofit in Sprint boot microservice communications. Before start, I have to highlight that it is a milestone version so this article will be preview of it :)</p><p>When you click the <a href="https://square.github.io/retrofit/">Square Retrofit</a> page, the first thing you will see is<em> A type-safe HTTP client for Android and Java</em>. Personally, Retrofit is my first choice as Http Client Library in both Android and Backend.</p><p>However, when you work on microservice with Sprint Boot, there are lots of microservice communication libraries from top to bottom as OpenFeign, Resttemplate or maybe WebClient if reactive approach has been chosen. Each of them has advantages and disadvantages at themselves. According to dependencies, architecture or approach, one of them can be suitable for your project.</p><p>My first choice is still OpenFeign in microservice, but sometimes, I wished that what if Retrofit can take OpenFeign and other libraries place! The main reason why Retrofit is my first choice is power of interceptors and easy implementation and async calls.</p><p>Approximately 1 year ago, I encountered such a wonderful video on <a href="https://www.youtube.com/watch?v=G8R-tEK18BY">YouTube</a> that Josh Long introduced Spring Cloud Square.</p><blockquote>As Josh Long mentioned I love OpenFeign but it does not do great with asynchronous or reactive sort of use cases. Finally so I am so glad there is an alternative.</blockquote><p>Spring Cloud Square is still in milestone version, I hope at the first quarter of the new year, stable version will be published. Till that day, let’s take a look at preview.</p><p>First, we include dependencies in gradle file.</p><pre>implementation ‘org.springframework.cloud:spring-cloud-square-retrofit:0.4.1’</pre><pre>implementation ‘org.springframework.cloud:spring-cloud-square-okhttp:0.4.1’</pre><p>After loading libraries, configuration class was generated for retrofit clients in application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a0fcd4a75a73ec4a08b4b968fa18679/href">https://medium.com/media/2a0fcd4a75a73ec4a08b4b968fa18679/href</a></iframe><p>In this demo, I used Retrofit with OkHttpClient and Spring Cloud LoadBalancer. But you can also use WebClient (<a href="https://github.com/spring-cloud-incubator/spring-cloud-square">https://github.com/spring-cloud-incubator/spring-cloud-square</a>). If Retrofit is used for also external Rest API, it might be helpful declaring basePackages for clarity of microservice communication.</p><p>Like classic Retrofit implementation, Service Interface is created for API’s. At that point, you have to add @RetrofitClient annotation for your microservice and if you have specific configuration for target microservice, you can add configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f24a1c28d7d6173d48b6b85eca78e0a2/href">https://medium.com/media/f24a1c28d7d6173d48b6b85eca78e0a2/href</a></iframe><p>At custom configuration, multiple interceptor can be added. In this example, there is token interceptor for security layer between microservice, authenticator interceptor for refreshing accessToken by using OkHttp Authenticator and also user specific headers such as language, app version and etc. If interceptors have dependencies itself such as token service implementation, interceptors should have added as autowired. Otherwise, classic approach can be used.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08bdbaa4064eaa07d6af5b6a601bc1d5/href">https://medium.com/media/08bdbaa4064eaa07d6af5b6a601bc1d5/href</a></iframe><p>After the development of API interface and configuration, client can be added to service. At this demo, error handling was done in abstract class but you can also add interceptor, it is totally depends on your service architecture.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/167b027fe02a4221ac48c612e76e754e/href">https://medium.com/media/167b027fe02a4221ac48c612e76e754e/href</a></iframe><p>With the help of Retrofit’s easy sync and async process ability, it will be wonderful alternative in microservice communication regarding to OpenFeign.</p><pre>2022-12-13 13:00:19.307  INFO [retrofitdemo,010ce3b09e6c23ff,010ce3b09e6c23ff] 8884 --- [nio-8085-exec-1] okhttp3.OkHttpClient                     : --&gt; GET http://welcome-service/v1/whoiam?name=Oguz<br>2022-12-13 13:00:19.424  INFO [retrofitdemo,010ce3b09e6c23ff,010ce3b09e6c23ff] 8884 --- [nio-8085-exec-1] okhttp3.OkHttpClient                     : &lt;-- 200 http://127.0.0.1:8086/v1/whoiam?name=Oguz&amp;constantQuery=fromInterceptor (116ms, unknown-length body)</pre><p>I hope Spring Cloud Square stable version will be published soon. Please CLAP :)</p><p><a href="https://github.com/spring-projects-experimental/spring-cloud-square">GitHub - spring-projects-experimental/spring-cloud-square: Spring Cloud auto-configuration of Retrofit and OkHttp (with Spring Cloud LoadBalancer).</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cd4445b001a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>