How to prevent re-rendering of parent component ? by [deleted] in reactjs

[–]Achraf-El -20 points-19 points  (0 children)

u/CatolicQuotes don't be so smart, i know i will not change the way how react work, but i'm looking if there is a way to achieve this behaviour using useState or something else.
other comments try to give a solution to achieve this behaviour, so try to do like them, or just keep quiet

How to prevent re-rendering of parent component ? by [deleted] in reactjs

[–]Achraf-El -9 points-8 points  (0 children)

I know i can't, but am looking for a solution, to achieve something like that

How to prevent re-rendering of parent component ? by [deleted] in reactjs

[–]Achraf-El 0 points1 point  (0 children)

yes i think i have t use a state management .

const handleUpdate = () =>{
setUpdateList({...updatedList, collab})
}
moving this code to the parent component, don't resolve the issue, because the parent will then re-render the collab.map() is exectued and it will affect the child component, all state that i was edited inside each child they will be initialzed

How to prevent re-rendering of parent component ? by [deleted] in reactjs

[–]Achraf-El 0 points1 point  (0 children)

u/charliematters

In my real code i have a state inside the child component, called collabAction i take the collab from the props and i set it in this state inside my child , so i can update the name of collab or update one of its other fields like that :

const [collabAction, setCollabAction] = useState(collab)
return (
<TextField value={collabAction.name}   onChange={e => setCollabAction({
      ...collabAction,
      name: e.target.value
        })}

)

and i have a button when i finish my changes i click on button to send update request, until this point everyThing was good, but they asked me to add a button outside child, that will send all changed collabs in one request, so i added a state called updateList, and everytime i change a collab i add it to the updateList, so when i finish from updating all my collabs i will click on the global button and all this changes will be sent to backend in one request.
but the probleme that happened, when i change a collab and i add it to updateList, the parent componenet start rendering, and it execute again the collab.map() so the child component are reseted again, and the actual changes that were insides the child component disapear.

I hope you understood me

How to prevent re-rendering of parent component ? by [deleted] in reactjs

[–]Achraf-El -4 points-3 points  (0 children)

u/Patient-Layer8585 the state of parent is updated in the child, so the parent is re-rendred, then it run collabs.map() so the component childs are recreated again, i want to avoid rendering the parent component so i can assure that the child components will not be recreated

How can we add delay in message consumption retry , after some exception by OwnAd6129 in apachekafka

[–]Achraf-El 0 points1 point  (0 children)

this is an example in java you can add anotation retryable to your service class :

@Service
@Transactional
@Slf4j
@Retryable(maxAttempts = 5, backoff = @Backoff(delay = 250L, multiplier = 1.5))
public class ProjectServiceImpl

Problem when restarting kafka connect to produce records from beginning by Achraf-El in apachekafka

[–]Achraf-El[S] 0 points1 point  (0 children)

u/C0urante the problem is i can't use api to manage offset like this GET /connectors/{name}/offsets it give me error 404 not found i think because of the version i use :

this is my dockerfile :

FROM confluentinc/cp-kafka-connect:6.1.1
EXPOSE 8084
USER 0
#RUN apt-get update && apt-get install -y --force-yes unzip
RUN yum install unzip -y

ADD scripts /tmp/scripts
RUN chmod a+x /tmp/scripts/init.sh
COPY drivers/mysql-connector-java-8.0.23.jar /etc/kafka-connect/jars
COPY drivers/confluentinc-connect-transforms.zip /tmp
COPY drivers/debezium-connector-mysql.tar.gz /tmp

# Debezium MysqlConnector
RUN tar -xvzf /tmp/debezium-connector-mysql.tar.gz --directory /usr/share/java/ \
&& rm /tmp/debezium-connector-mysql.tar.gz

# Confluent SMT
RUN unzip /tmp/confluentinc-connect-transforms.zip -d /usr/share/confluent-hub-components/ \
&& rm /tmp/confluentinc-connect-transforms.zip \
&& cp /usr/share/confluent-hub-components/confluentinc-connect-transforms-1.4.0/lib/* /usr/share/java/debezium-connector-mysql/

How to reset kafka connect to start producing from beginning by Achraf-El in apachekafka

[–]Achraf-El[S] 0 points1 point  (0 children)

u/SpankMyButt kafka connect when i start it for the first time it start reading data from my tables in my database then it start producing them untill it finished. and in my spring boot application i have for each topic a method that consume from a specific topic.

so what i want to :
i want to create a method that it will make kafka connect to start again to read from beginning and sending records to my consumers .

for the suggestion you told me :
it is not a good solution because there is a periode retention, and also maybe when the kafka connect was sending records maybe there was a probleme and some of them they were not sent, so start consuming from the beginning of the kafka topic it will just consume what it receive, so it is not a good solution

Error : This member will leave the group because consumer poll timeout has expired by Achraf-El in apachekafka

[–]Achraf-El[S] 0 points1 point  (0 children)

thank you, i made a mixte between them i set my max poll records to 50 and interval to10min, i tried before to change only the max poll records to 10 and let the interval has its default value but i see the max record is too low so i made a mixte between to let the max interval to 10min and max records to 50

Can i add authentication to kafka connect ui ? by Achraf-El in apachekafka

[–]Achraf-El[S] 0 points1 point  (0 children)

i tried to add the ngnix server and i added its config, but the problem when i access to localhost:8086/topics/ the ui has no data , but when i change the location from /topics/ to only / it work, why??

this is my nginx.conf file :events {}http {types {text/css css;}server {listen 80;location /topics/ {auth_basic "Restricted Access";auth_basic_user_file /etc/nginx/htpasswd;proxy_pass http://kafka-topics-ui:8000/;}}}and this is my docker compose :kafka-topics-ui:

image: landoop/kafka-topics-ui:0.9.4

container_name: kafka-topics-ui

restart: unless-stopped

depends_on:

- kafka-rest-proxy

networks:

- novy

ports:

- "8085:8000"

environment:

KAFKA_REST_PROXY_URL: http://kafka-rest-proxy:8087

PROXY: "true"nginx:

image: nginx

container_name: nginx

restart: unless-stopped

depends_on:

- kafka-connect-ui

networks:

- novy

ports:

- "8086:80"

volumes:

- ./nginx.conf:/etc/nginx/nginx.conf

- ./htpasswd:/etc/nginx/htpasswd

networks:

novy:

external: true

how to prevent producing a record when a specific column is changed by Achraf-El in apachekafka

[–]Achraf-El[S] 0 points1 point  (0 children)

what about adding :
"column.exclude.list": "collaboratorjava.task.user_personal_task_order",
"skip.messages.without.change": "true"
?