rocketmq | Apache RocketMQ is a cloud native messaging | Pub Sub library
kandi X-RAY | rocketmq Summary
Support
Quality
Security
License
Reuse
- Moves forward to the next state in the input stream
- initialize the manager
- Internal implementation .
- Create a broker instance .
- Start the consumer
- Sends a consumer send message back to a remoting command
- Check the message and return the response .
- parses the expression
- Invoked when a channel is destroyed .
- Returns a string representation of the properties .
rocketmq Key Features
rocketmq Examples and Code Snippets
Trending Discussions on rocketmq
Trending Discussions on rocketmq
QUESTION
I'm trying to deploy rocketmq on my testing cluster. I started from the scripts provided in the apache/rocketmq-docker repo on github, but they do not work. I created my own yaml deployment starting from the one in the repo I previously cited, and it works for mqnamsrv, but not for broker. In the following the 2 deployments:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rocketmq-namesrv
spec:
replicas: 1
selector:
matchLabels:
app: rocketmq-namesrv
template:
metadata:
labels:
app: rocketmq-namesrv
spec:
containers:
- name: namesrv
image: myrepo/rocketmq:4.9.3-alpine
command: ["sh", "mqnamesrv"]
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "128Mi"
cpu: "400m"
ports:
- containerPort: 9876
volumeMounts:
- name: namesrv-log
mountPath: /var/log
volumes:
- name: namesrv-log
persistentVolumeClaim:
claimName: rocketmq-namesrv-pvc
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: rocketmq-broker
spec:
replicas: 1
selector:
matchLabels:
app: rocketmq-broker
template:
metadata:
labels:
app: rocketmq-broker
spec:
containers:
- name: broker
image: myrepo/rocketmq:4.9.3-alpine
command: ["sh", "mqbroker", "-n", "localhost:9876"]
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "128Mi"
cpu: "400m"
ports:
- containerPort: 10909
- containerPort: 10911
volumeMounts:
- name: broker-log
mountPath: /var/log
- name: broker-store
mountPath: /home/rocketmq
volumes:
- name: broker-log
persistentVolumeClaim:
claimName: rocketmq-broker-log-pvc
- name: broker-store
persistentVolumeClaim:
claimName: rocketmq-broker-store-pvc
The image rocketmq:4.9.3-alpine
was created following the procedure on the apache/rocketmq-docker repo.
After the deployment the rocketmq-namesrv works, but the broker's pod logs: sh: can't open 'mqbroker': No such file or directory
. ut if I try to run manually the container with kubectl run -ti rocketmq-broker --image=myrepo/rocketmq:4.9.3-alpine --restart=Never -- sh mqbroker -n localhost:9876
it works...
What could it be the problem in the yaml? Am I making something wrong?
ANSWER
Answered 2022-Mar-09 at 11:23I think the problem is with the mount path.
- name: broker-store
mountPath: /home/rocketmq
So your binaries won't be there and so the error
QUESTION
I have an app that get data from a third-party data source, it will send data to my app automatically and I can't filter it, I can only receive all. When data arrive, my app will transmit this data to a rocketmq topic.
Now I have to make this app a container and deploy it in k8s deployment with 3 replica. But these pods will all get same data and send to the same rocketmq topic.
How do I make this app horizontal scalable without sending duplicate msg to the same rocketmq topic?
ANSWER
Answered 2021-Sep-28 at 17:22Now I have to make this app a container and deploy it in k8s deployment with 3 replica. But these pods will all get same data and send to the same rocketmq topic.
There is no request. My app connect to a server and it will send data to app by TCP. Every Pod will connect to that server.
If you want to do this with more than one instance, they need to coordinate in some way.
Leader Election pattern is a way to run multiple instances, but only one can be active (e.g. when you read from the same queue). This is a pattern to coordinate - only one instance is active at the time. So this pattern only use your replicas for higher availability.
If you want that all your replicas actively work, this can be done with techniques like sharding or partitioning. This is also how e.g. Kafka (e.g. similar to a queue) makes concurrent work from queues.
There are other ways to solve this problem as well, e.g. to implement some form of locks to coordinate - but partitioning or sharding as in Kafka is probably the most "cloud native" solution.
QUESTION
Here I am using spring-cloud-starter-stream-rocketmq and spring-message to send message dn, e.g.
Message m = MessageBuilder.withPayload(obj).setHeader(RocketMQHeaders.TAGS, tag).build();
MessageChannel.output().send(m);
But I want to set the message expire time in the queue if that not be consumed.
I know the rocketmq could set the ttl, but I don't know whether that can be set for different message and how can be used in the code before?
ANSWER
Answered 2021-Mar-05 at 09:16I am afraid that you are wrong.
RocketMQ does not support ttl which means the message will NOT be deleted controlled by a client parameter, though the message will be indeed deleted after a period of time(for example 7 days).
So if you need to implement a ttl like consuming, you should do it in your consumer like:
if (System.currentTimeMills()-msg.getStoreTimestamp > SOME_TIME) {
//DO NOT CONSUME
}
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rocketmq
You can use rocketmq like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the rocketmq component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page