This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.flink.api.common.typeutils.TypeSerializer; | |
import org.apache.flink.api.common.typeutils.TypeSerializerSnapshot; | |
import org.apache.flink.api.common.typeutils.base.ListSerializer; | |
import org.apache.flink.core.memory.DataInputView; | |
import org.apache.flink.core.memory.DataOutputView; | |
import java.io.IOException; | |
import java.util.LinkedHashSet; | |
import java.util.Objects; | |
import java.util.Set; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Salesforce doesn't include expires_in in its token response, so Spring assumes it's only valid for 1 second. | |
// Considering clock skew logic, each token is basically valid for a single call, | |
// so you might want to force the assumption that it can be valid for a little longer. | |
class CustomJwtBearerTokenResponseClient( | |
private val minimumTokenDuration: Duration | |
) : OAuth2AccessTokenResponseClient<JwtBearerGrantRequest> { | |
private val defaultClient = DefaultJwtBearerTokenResponseClient() | |
override fun getTokenResponse(authorizationGrantRequest: JwtBearerGrantRequest): OAuth2AccessTokenResponse { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `snapshot and subsequent restore`() { | |
// non-empty function (knows about active customers) | |
val function = getFunctionForTesting() | |
val (operatorId, stateFinalizer) = getHarness(function).use { harness -> | |
harness.processBroadcastElement(GenericChangeMessage(), 1L) | |
val stateFinalizer = harness.snapshotWithLocalState(0L, 1L) | |
assertEquals(1, stateFinalizer.jobManagerOwnedState.managedOperatorState.size) | |
Pair(harness.streamConfig.operatorID, stateFinalizer) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// kotlin POJO | |
import java.io.Serializable | |
data class StateCounts( | |
var windowState: Int = 0, | |
var globalState: Int = 0, | |
var windows: Int = 0, | |
var dtos: Int = 0, | |
val dtoBytes: Long = 0L, | |
) : Serializable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gradle plugins require a marker: | |
https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers | |
Markers aren't published for precompiled scripts using groovy-gradle-plugin :( | |
https://github.com/gradle/gradle/issues/15190 | |
The plugin_marker module creates the marker that Gradle needs to find the plugin and also publishes it, | |
see https://stackoverflow.com/a/60798021/5793905 | |
Assuming all gradle modules have the same group with a folder structure like: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class WC(var word: String, var count: Int) : Serializable { | |
constructor() : this("", 0) | |
} | |
class KS : KeySelector<WC, Int> { | |
private var count = 0 | |
override fun getKey(value: WC): Int { | |
println("count=$count, value=$value") | |
return if (count++ < 2) 0 else 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nodes": [ | |
{ | |
"id": 4, | |
"type": "source", | |
"pact": "Data Source", | |
"contents": "at org.apache.flink.api.scala.ExecutionEnvironment.createInput(ExecutionEnvironment.scala:390) (org.apache.flink.api.java.io.jdbc.JDBCInputFormat)", | |
"parallelism": "24", | |
"global_properties": [ |