1. add(E element) – Adds the specified element to the end of the list.
2. addAll(Collection<? extends E> c) – Adds all elements of the specified collection to the end of the list.
3. remove(Object o) – Removes the first occurrence of the specified element from the list.
4. remove(int index) – Removes the element at the specified position in the list.
5. get(int index) – Returns the element at the specified position in the list.
6. set(int index, E element) – Replaces the element at the specified position in the list with the specified element.
7. indexOf(Object o) – Returns the index of the first occurrence of the specified element in the list.
8. contains(Object o) – Returns true if the list contains the specified element.
9. size() – Returns the number of elements in the list.
10. isEmpty() – Returns true if the list contains no elements.
11. clear() – Removes all elements from the list.
12. toArray() – Returns an array containing all the elements in the list.
13. subList(int fromIndex, int toIndex) – Returns a view of the portion of the list between the specified fromIndex, inclusive, and toIndex, exclusive.
14. addAll(int index, Collection<? extends E> c) – Inserts all elements of the specified collection into the list, starting at the specified position.
15. iterator() – Returns an iterator over the elements in the list.
16. sort(Comparator<? super E> c) – Sorts the elements of the list according to the specified comparator.
17. replaceAll(UnaryOperator operator) – Replaces each element of the list with the result of applying the given operator.
18. forEach(Consumer<? super E> action) – Performs the given action for each element of the list until all elements have been processed or the action throws an exception.
Kafka was originally built for massive log processing. It retains messages until expiration and lets consumers pull messages at their own pace. Let’s review the popular Kafka use cases.
Step 1 – The client sends an HTTP request to the API gateway.
Step 2 – The API gateway parses and validates the attributes in the HTTP request.
Step 3 – The API gateway performs allow-list/deny-list checks.
Step 4 – The API gateway talks to an identity provider for authentication and authorization.
Step 5 – The rate limiting rules are applied to the request. If it is over the limit, the request is rejected.
Steps 6 and 7 – Now that the request has passed basic checks, the API gateway finds the relevant service to route to by path matching.
Step 8 – The API gateway transforms the request into the appropriate protocol and sends it to backend microservices.
Steps 9-12: The API gateway can handle errors properly, and deals with faults if the error takes a longer time to recover (circuit break). It can also leverage ELK (Elastic-Logstash-Kibana) stack for logging and monitoring. We sometimes cache data in the API gateway.
Over to you: 1) What’s the difference between a load balancer and an API gateway? 2) Do we need to use different API gateways for PC, mobile and browser separately?
1. add(E element) – Adds the specified element to the end of the list.
2. addAll(Collection<? extends E> c) – Adds all elements of the specified collection to the end of the list.
3. remove(Object o) – Removes the first occurrence of the specified element from the list.
4. remove(int index) – Removes the element at the specified position in the list.
5. get(int index) – Returns the element at the specified position in the list.
6. set(int index, E element) – Replaces the element at the specified position in the list with the specified element.
7. indexOf(Object o) – Returns the index of the first occurrence of the specified element in the list.
8. contains(Object o) – Returns true if the list contains the specified element.
9. size() – Returns the number of elements in the list.
10. isEmpty() – Returns true if the list contains no elements.
11. clear() – Removes all elements from the list.
12. toArray() – Returns an array containing all the elements in the list.
13. subList(int fromIndex, int toIndex) – Returns a view of the portion of the list between the specified fromIndex, inclusive, and toIndex, exclusive.
14. addAll(int index, Collection<? extends E> c) – Inserts all elements of the specified collection into the list, starting at the specified position.
15. iterator() – Returns an iterator over the elements in the list.
16. sort(Comparator<? super E> c) – Sorts the elements of the list according to the specified comparator.
17. replaceAll(UnaryOperator operator) – Replaces each element of the list with the result of applying the given operator.
18. forEach(Consumer<? super E> action) – Performs the given action for each element of the list until all elements have been processed or the action throws an exception.