Skip to content

Commit

Permalink
138 review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
attila-kiss-it committed Jan 16, 2025
1 parent 11521b3 commit dcef67c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ public void paint(String carProductionId) throws BaseException {
// data query for validation
CarProduction carProduction = carProductionService.findById(carProductionId, CarProduction.class);

// prepare the stream message of the next consumer
String streamMessage = carProduction.getId();

ProductionStatus actualStatus = carProduction.getProductionStatus();

// validate the data based on the state the consumer accepts for processing
Expand All @@ -109,6 +106,8 @@ public void paint(String carProductionId) throws BaseException {
// ===== STEP-2: COLLECT AND PROCESS DATA =====
// ============================================

// prepare the stream message of the next consumer

// REST call for external data query
String color = carOrderRestClient.getColor("carOrderId");

Expand All @@ -129,7 +128,7 @@ public void paint(String carProductionId) throws BaseException {
// create the process record of the next consumer
ProcessCarPaintedToAssembled processCarPaintedToAssembled = new ProcessCarPaintedToAssembled();
processCarPaintedToAssembled.setCarProduction(carProduction);
processCarPaintedToAssembled.setStreamMessage(streamMessage);
processCarPaintedToAssembled.setStreamMessage(carProduction.getId());

// ... create and modify entities

Expand Down Expand Up @@ -160,7 +159,7 @@ public void paint(String carProductionId) throws BaseException {
// fire an async event to publish the stream message to the next redis stream
// the consumer execution is successful either if the redish operation fails, the failover solution will retry it later
asyncRedisPublishEventDispatcher.fireAsyncRedisPublishEvent(
streamMessage,
processCarPaintedToAssembled.getStreamMessage(),
RedisStreamConstant.CarProduction.Assembler.CONFIG_KEY,
RedisStreamConstant.CarProduction.Assembler.GROUP);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
/*-
* #%L
* Sampler
* %%
* Copyright (C) 2022 - 2025 i-Cell Mobilsoft Zrt.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package hu.icellmobilsoft.sampler.sample.comsumerservice.redis;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.Initialized;
import jakarta.enterprise.event.Observes;

import hu.icellmobilsoft.coffee.module.redisstream.bootstrap.BaseRedisConsumerStarter;

/**
* Minden Redis stream consumer indításáért felel
*
* @author attila.kiss
* @since 2.0.0
*/
@ApplicationScoped
public class RedisConsumerStarter extends BaseRedisConsumerStarter {

/**
* CDI event observer
*
* @param init
* CDI
*/
public void begin(@Observes @Initialized(ApplicationScoped.class) Object init) {
start();
}
}
/*-
* #%L
* Sampler
* %%
* Copyright (C) 2022 - 2025 i-Cell Mobilsoft Zrt.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package hu.icellmobilsoft.sampler.sample.comsumerservice.redis;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.Initialized;
import jakarta.enterprise.event.Observes;

import hu.icellmobilsoft.coffee.module.redisstream.bootstrap.BaseRedisConsumerStarter;

/**
* Redis consumer starter.
*
* @author attila.kiss
* @since 2.0.0
*/
@ApplicationScoped
public class RedisConsumerStarter extends BaseRedisConsumerStarter {

/**
* CDI event observer to start all of the redis stream consumers.
*
* @param init
* CDI
*/
public void begin(@Observes @Initialized(ApplicationScoped.class) Object init) {
start();
}
}

0 comments on commit dcef67c

Please sign in to comment.