Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery.common.java
/
microservice
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7a29526c
authored
Dec 29, 2019
by
Amir Aharon
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update to pulsar 2.4.2 and fix PubSubMsg
parent
ea1a3f21
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
build.gradle
src/common/java/common/microservice/context/PubSubMsg.java
src/test/java/microservice/TestPulsar.java
build.gradle
View file @
7a29526c
...
@@ -60,8 +60,8 @@ dependencies {
...
@@ -60,8 +60,8 @@ dependencies {
'org.elasticsearch.client:rest:5.4.1'
,
'org.elasticsearch.client:rest:5.4.1'
,
'com.netflix.rxjava:rxjava-apache-http:0.20.7'
,
'com.netflix.rxjava:rxjava-apache-http:0.20.7'
,
'com.squareup.okhttp3:okhttp:3.8.0'
,
'com.squareup.okhttp3:okhttp:3.8.0'
,
'org.apache.pulsar:pulsar-client:2.
2.1
'
,
'org.apache.pulsar:pulsar-client:2.
4.2
'
,
'org.apache.pulsar:pulsar-client-admin:2.
2.1
'
'org.apache.pulsar:pulsar-client-admin:2.
4.2
'
)
)
// compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.2'
// compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.2'
...
...
src/common/java/common/microservice/context/PubSubMsg.java
View file @
7a29526c
...
@@ -21,6 +21,9 @@ public class PubSubMsg {
...
@@ -21,6 +21,9 @@ public class PubSubMsg {
this
.
parameters
=
parameters
;
this
.
parameters
=
parameters
;
}
}
public
PubSubMsg
()
{
}
PubSubMsg
addParameter
(
String
param
,
String
value
){
PubSubMsg
addParameter
(
String
param
,
String
value
){
if
(
parameters
==
null
)
if
(
parameters
==
null
)
parameters
=
new
HashMap
<>();
parameters
=
new
HashMap
<>();
...
...
src/test/java/microservice/TestPulsar.java
View file @
7a29526c
...
@@ -36,14 +36,18 @@ public class TestPulsar {
...
@@ -36,14 +36,18 @@ public class TestPulsar {
.
build
();
.
build
();
Producer
<
PubSubMsg
>
producer
=
client
.
newProducer
(
JSONSchema
.
of
(
PubSubMsg
.
class
))
Producer
<
PubSubMsg
>
producer
=
client
.
newProducer
(
JSONSchema
.
of
(
PubSubMsg
.
class
))
.
topic
(
topic
)
.
topic
(
topic
)
.
create
();
.
create
();
// final Producer<byte[]> producer = client.newProducer().topic(topic).create();
// Publish 10 messages to the topic
// Publish 10 messages to the topic
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
PubSubMsg
pubSubMsg
=
new
PubSubMsg
(
"hello - "
+
String
.
valueOf
(
System
.
currentTimeMillis
()),
String
.
valueOf
(
i
));
PubSubMsg
pubSubMsg
=
new
PubSubMsg
(
"hello - "
+
String
.
valueOf
(
System
.
currentTimeMillis
()),
String
.
valueOf
(
i
));
producer
.
send
(
pubSubMsg
);
producer
.
send
(
pubSubMsg
);
// producer.send(String.format("Message number %d", i).getBytes());
System
.
out
.
println
(
"Sending message"
);
System
.
out
.
println
(
"Sending message"
);
// final Message message = MessageBuilder.create()
// final Message message = MessageBuilder.create()
// .setContent(String.format("Message number %d", i).getBytes())
// .setContent(String.format("Message number %d", i).getBytes())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment