11/**
2- * Copyright 2023 Sven Loesekann
3- Licensed under the Apache License, Version 2.0 (the "License");
4- you may not use this file except in compliance with the License.
5- You may obtain a copy of the License at
6- http://www.apache.org/licenses/LICENSE-2.0
7- Unless required by applicable law or agreed to in writing, software
8- distributed under the License is distributed on an "AS IS" BASIS,
9- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10- See the License for the specific language governing permissions and
11- limitations under the License.
2+ * Copyright 2023 Sven Loesekann
3+ * Licensed under the Apache License, Version 2.0 (the "License");
4+ * you may not use this file except in compliance with the License.
5+ * You may obtain a copy of the License at
6+ * http://www.apache.org/licenses/LICENSE-2.0
7+ * Unless required by applicable law or agreed to in writing, software
8+ * distributed under the License is distributed on an "AS IS" BASIS,
9+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+ * See the License for the specific language governing permissions and
11+ * limitations under the License.
1212 */
1313package de .xxx .dbtorest .source ;
1414
1919import org .springframework .stereotype .Service ;
2020import org .springframework .transaction .annotation .Transactional ;
2121
22+ import java .util .Optional ;
23+ import java .util .function .Predicate ;
24+
2225@ Service
2326@ Transactional
2427public class DbChangeSourceService {
@@ -31,6 +34,7 @@ public DbChangeSourceService(KafkaProducer kafkaProducer) {
3134
3235 public void sendChange (DbChangeDto dbChangeDto ) {
3336 //LOGGER.info(dbChangeDto.toString());
34- this .kafkaProducer .sendDbChangeMsg (dbChangeDto );
37+ Optional .ofNullable (dbChangeDto .value ()).stream ().filter (Predicate .not (String ::isBlank )).findFirst ()
38+ .ifPresent (x -> this .kafkaProducer .sendDbChangeMsg (dbChangeDto ));
3539 }
3640}
0 commit comments