Skip to content

Instantly share code, notes, and snippets.

View haigopi's full-sized avatar
💭
Who loves to code!

Gopi haigopi

💭
Who loves to code!
View GitHub Profile
/**
* Created by Gopi K Kancharla
* 8/13/18 4:16 PM
*/
@Slf4j
@Path("/")
@Consumes({javax.ws.rs.core.MediaType.APPLICATION_JSON})
@Produces({javax.ws.rs.core.MediaType.APPLICATION_JSON})
public class TestController {
println("typeof(1) : ", typeof(1)) # --> typeof(1): Int64 <-- Prints the datatype:
println("Sys.WORD_SIZE : ",Sys.WORD_SIZE) # Sys.WORD_SIZE: 64 <-- This is an internal Variable
println("Int : ", Int) # Int: Int64
println("typemin(Int64) -> typemax(Int64) : ",typemin(Int64), " -> ", typemax(Int64))
# typemin(Int64) -> typemax(Int64): -9223372036854775808 -> 9223372036854775807 <-- Explains about the range
for T in [Int64, UInt8, UInt16, UInt32, UInt64, UInt128]
println("$(lpad(T, 25)): [$(typemin(T)), $(typemax(T))]")
end
disposable = consumer
.flatMap(r -> r.publishOn(scheduler)
.concatMap(b ->
Flux.just(b)
.concatMap(a -> {
if(!isEligibleToProcess(a)){
return Mono.just(a);
}
@haigopi
haigopi / SampleConsumer.java
Created June 4, 2019 00:35
A Test Consumer
public void createReceiverAndStartConsumingEvents() {
scheduler = Schedulers.newElastic(schedulerThreadName, 60, false);
// scheduler = Schedulers.single();
log.info("Consumer in Action: {}", eventConsumer.getClass().getSimpleName());
ReceiverOptions<Integer, String> options = ReceiverOptions.create(props);
receiverOptions = options.subscription(Collections.singleton(topic))
.addAssignListener(partitions -> {
assignedPartitions = partitions;
@haigopi
haigopi / AssignedPartitions.java
Last active August 4, 2019 22:38
Assigned Partitions Check
private Map<String, Long> dupCheckMap = new ConcurrentHashMap<>();
private boolean isEligibleToProcess(ReceiverRecord<Integer, String> a){
if (isOffsetBelowExpectedValue(a)) {
return false;
}
if(!isAssignedPartition(a)) {
log.info("Event Dropped: Partition {} not exists with {} anymore", a.receiverOffset(), name);
@haigopi
haigopi / assignedPartitions.log
Last active June 4, 2019 01:15
Assigned Partitions
[r-k-G-1] 20:02:01.737 - INFO c.FluxDeferConsumer - TestConsumer Partitions Assigned [ newRebalanceTest_2, newRebalanceTest_1, newRebalanceTest_4, newRebalanceTest_3, newRebalanceTest_0, newRebalanceTest_9, newRebalanceTest_6, newRebalanceTest_5, newRebalanceTest_8, newRebalanceTest_7, ]
[r-k-G-1] 20:03:01.741 - INFO c.FluxDeferConsumer - TestConsumer Partitions Revoked [ newRebalanceTest_2, newRebalanceTest_1, newRebalanceTest_4, newRebalanceTest_3, newRebalanceTest_0, newRebalanceTest_9, newRebalanceTest_6, newRebalanceTest_5, newRebalanceTest_8, newRebalanceTest_7, ]
[r-k-G-2] 20:03:01.747 - INFO c.FluxDeferConsumer - TestConsumer_A Partitions Assigned [ newRebalanceTest_9, newRebalanceTest_6, newRebalanceTest_5, newRebalanceTest_8, newRebalanceTest_7, ]
[r-k-G-1] 20:03:01.748 - INFO c.FluxDeferConsumer - TestConsumer Partitions Assigned [ newRebalanceTest_2, newRebalanceTest_1, newRebalanceTest_4, newRebalanceTest_3, newRebalanceTest_0, ]
[r-k-G-2] 20:04:31.753 - INFO c.FluxDeferConsumer -
@haigopi
haigopi / droppedMessages.log
Created June 4, 2019 01:21
Messages Dropped
[FLX_DFRTHRD-17] 20:05:05.855 correlationId= INFO FluxDeferConsumer - Event Dropped: Partition newRebalanceTest-7@1044 not exists with TestConsumer_A anymore after processed. Results a duplicate
[FLX_DFRTHRD-17] 20:05:05.855 correlationId= INFO FluxDeferConsumer - Event Dropped: Partition newRebalanceTest-7@1045 not exists with TestConsumer_A anymore
[FLX_DFRTHRD-17] 20:05:05.855 correlationId= INFO FluxDeferConsumer - Event Dropped: Partition newRebalanceTest-7@1046 not exists with TestConsumer_A anymore
[FLX_DFRTHRD-17] 20:05:05.855 correlationId= INFO FluxDeferConsumer - Event Dropped: Partition newRebalanceTest-7@1047 not exists with TestConsumer_A anymore
[FLX_DFRTHRD-17] 20:05:05.856 correlationId= INFO FluxDeferConsumer - Event Dropped: Partition newRebalanceTest-7@1048 not exists with TestConsumer_A anymore
[FLX_DFRTHRD-17] 20:05:05.856 correlationId= INFO FluxDeferConsumer - Event Dropped: Partition newRebalanceTest-7@1049 not exists with TestConsumer_A anymore
[FLX_DFRTHRD-17] 20:0
[FLX_DFR_THRD-16] 20:08:26.023 INFO DrainingConsumer - TestConsumer_A: Processed : newRebalanceTest-8@1046 - -8330065604307638520
[FLX_DFR_THRD-4 ] 20:08:26.164 INFO DrainingConsumer - TestConsumer: Processed : newRebalanceTest-4@1047 - 5076188712961776780
[FLX_DFR_THRD-9 ] 20:08:26.164 INFO DrainingConsumer - TestConsumer: Processed : newRebalanceTest-5@1075 - 2116866269104886050
[FLX_DFR_THRD-19] 20:08:26.187 INFO DrainingConsumer - TestConsumer_B: Processed : newRebalanceTest-2@1042 - -2423949157062327301
[FLX_DFR_THRD-21] 20:08:26.187 INFO DrainingConsumer - TestConsumer_B: Processed : newRebalanceTest-3@1138 - -5578544994813872621
[FLX_DFR_THRD-31] 20:08:28.112 INFO DrainingConsumer - TestConsumer_D: Processed : newRebalanceTest-7@1101 - -2763295860293419211
[FLX_DFR_THRD-30] 20:08:28.112 INFO DrainingConsumer - TestConsumer_D: Processed : newRebalanceTest-6@1066 - -5891291829998467939
[FLX_DFR_THRD-25] 20:08:28.159 INFO DrainingConsumer - TestConsumer_C: Proces
@haigopi
haigopi / property.properties
Created August 4, 2019 22:56
Cloud App Config Externalization. No more Restarts & ReDeployments!
encrypt.key-store.location=file://serverKeyStorePKCS12.jks
encrypt.key-store.password=myPassword
encrypt.key-store.alias=testKeyName
@haigopi
haigopi / keytool.sh
Last active August 4, 2019 22:59
Cloud App Config Externalization. No more Restarts & ReDeployments!
keytool -genkeypair -alias testKeyName
-keyalg RSA -dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=US"
-keypass testPassword -keystore serverKeyStore.jks -storepass myPassword
keytool -importkeystore
-srckeystore serverKeyStore.jks
-destkeystore serverKeyStorePKCS12.jks deststoretype pkcs12