# Changing the processing mode using the Java SDK

**URL:** <https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [September 29, 2024, 3:45pm UTC](https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533 "2024-09-29T15:45:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyril\_Poder](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/cyril_poder/32/17142_2.png) [@Cyril\_Poder](https://community.cumulocity.com/u/Cyril_Poder)\
**Post date:** [September 29, 2024, 3:45pm UTC](https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533/1 "2024-09-29T15:45:43Z")

</div>

#### _ **Product/components** used and **version/fix** level:_ Java SDK 10.15

#### _Detailed explanation of the problem:_ I need to use the “transient” mode to send data to the platform from my Java microservice, however that doesn’t seem to be possible without implementing my own REST client. There is a ProcessingMode enum, but it doesn’t seem to be used anywhere. Can this be done with the SDK or should I use my own REST client as I suspect?

#### _Error messages / **full error** message screenshot / **log** file:_ N/A

#### _Question related to a **free trial** , or to a **production (customer)** instance?_ Prod

---

<div class="post-metadata">

**Author:** ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)\
**Post date:** [September 30, 2024, 9:02am UTC](https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533/2 "2024-09-30T09:02:50Z")

</div>

Processing mode is set by adding the `X-Cumulocity-Processing-Mode` header to any request. The intended way of accessing headers in cumulocity java client is through interceptors.

You can register an interceptor on your desired `Platform` bean using the `registerInterceptor()` method. You can instantiate a separate `Platform` bean for this purpose or try to modify the ones provided by the SDK.

see: [cumulocity-clients-java/java-client/src/main/java/com/cumulocity/sdk/client/PlatformParameters.java at develop · Cumulocity-IoT/cumulocity-clients-java · GitHub](https://github.com/Cumulocity-IoT/cumulocity-clients-java/blob/develop/java-client/src/main/java/com/cumulocity/sdk/client/PlatformParameters.java#L285C20-L285C39)

---

<div class="post-metadata">

**Author:** ![Cyril\_Poder](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/cyril_poder/32/17142_2.png) [@Cyril\_Poder](https://community.cumulocity.com/u/Cyril_Poder)\
**Post date:** [September 30, 2024, 9:24am UTC](https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533/3 "2024-09-30T09:24:55Z")

</div>

Ok thanks, just understood that I had to explicitely cast the Platform bean to PlatformImpl. Not nice, but that does the job.

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [September 30, 2024, 11:27am UTC](https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533/4 "2024-09-30T11:27:11Z")

</div>

@Cyril_Poder Would it be possible to post a code example how you finally achieved changing the processing mode?

---

<div class="post-metadata">

**Author:** ![Cyril\_Poder](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/cyril_poder/32/17142_2.png) [@Cyril\_Poder](https://community.cumulocity.com/u/Cyril_Poder)\
**Post date:** [September 30, 2024, 1:03pm UTC](https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533/5 "2024-09-30T13:03:33Z")

</div>

Yep, basically you first inject the platform bean in you class, like:

```java
private final Platform platform;

```

given that you’re using Lombok with `@RequiredArgsConstructor` annotation.  
Then you’d have something like:

```auto
            ((PlatformImpl)platform).registerInterceptor((new HttpClientInterceptor() {
               @Override
               public Invocation.Builder apply(Invocation.Builder builder) {
                   return builder.header("X-Cumulocity-Processing-Mode", "TRANSIENT");
               } 
            }));

```

The imports, in case you’re wondering, for Platform and Invocation.Builder are:

```auto
import com.cumulocity.sdk.client.Platform;
import com.cumulocity.sdk.client.PlatformImpl;
import javax.ws.rs.client.Invocation;

```

Of course this is not how one should implement it, as doing this you definately change the processing mode, so you’d rather either unregister the interceptor after your call or handle the value of the processing mode centrally, but that’s up to what you need to achieve.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [March 29, 2025, 1:04pm UTC](https://community.cumulocity.com/t/changing-the-processing-mode-using-the-java-sdk/7533/6 "2025-03-29T13:04:22Z")

</div>

Closed on March 29, 2025, 1:04pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
