记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
cfb6a42d
Commit
cfb6a42d
authored
May 15, 2022
by
zhanggb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~consumer:+listener;
parent
dc7b1baf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
27 deletions
+47
-27
ConsumerCommonBizRedisStreamConfig.java
...mer/slowly/config/ConsumerCommonBizRedisStreamConfig.java
+1
-1
ConsumerCommonSqlRedisStreamConfig.java
...mer/slowly/config/ConsumerCommonSqlRedisStreamConfig.java
+1
-1
ConsumerGoblinOrderCRedisStreamConfig.java
.../slowly/config/ConsumerGoblinOrderCRedisStreamConfig.java
+45
-25
No files found.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-slowly/src/main/java/com/liquidnet/service/consumer/slowly/config/ConsumerCommonBizRedisStreamConfig.java
View file @
cfb6a42d
...
@@ -120,7 +120,7 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
...
@@ -120,7 +120,7 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
BIZ_ARTWORK_GEN
;
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
BIZ_ARTWORK_GEN
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
1
;
i
++)
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-slowly/src/main/java/com/liquidnet/service/consumer/slowly/config/ConsumerCommonSqlRedisStreamConfig.java
View file @
cfb6a42d
...
@@ -86,7 +86,7 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
...
@@ -86,7 +86,7 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
SQL_ARTWORK_GEN
;
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
SQL_ARTWORK_GEN
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
1
;
i
++)
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-slowly/src/main/java/com/liquidnet/service/consumer/slowly/config/ConsumerGoblinOrderCRedisStreamConfig.java
View file @
cfb6a42d
...
@@ -12,37 +12,43 @@ import org.springframework.data.redis.connection.stream.Consumer;
...
@@ -12,37 +12,43 @@ import org.springframework.data.redis.connection.stream.Consumer;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
@Configuration
@Configuration
public
class
ConsumerGoblinOrderCRedisStreamConfig
extends
RedisStreamConfig
{
public
class
ConsumerGoblinOrderCRedisStreamConfig
extends
RedisStreamConfig
{
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Autowired
@Autowired
ConsumerGoblinOrderCloseRdsReceiver
consumerGoblinOrderCloseRdsReceiver
;
ConsumerGoblinOrderCloseRdsReceiver
consumerGoblinOrderCloseRdsReceiver
;
/**
//
/**
* 缺票登记
//
* 缺票登记
*
//
*
* @param listenerContainer
//
* @param listenerContainer
* @param t
//
* @param t
* @return
//
* @return
*/
//
*/
private
Subscription
receiveGoblinOrderCOrder
(
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
,
int
t
)
{
//
private Subscription receiveGoblinOrderCOrder(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
MQConst
.
GoblinQueue
.
GOBLIN_ORDER_CLOSE
.
getGroup
(),
getConsumerName
(
MQConst
.
GoblinQueue
.
GOBLIN_ORDER_CLOSE
.
name
()
+
t
)),
//
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.name() + t)),
StreamOffset
.
create
(
MQConst
.
GoblinQueue
.
GOBLIN_ORDER_CLOSE
.
getKey
(),
ReadOffset
.
lastConsumed
()),
consumerGoblinOrderCloseRdsReceiver
);
//
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getKey(), ReadOffset.lastConsumed()), consumerGoblinOrderCloseRdsReceiver);
}
//
}
//
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
/* -------------------------------------------------------- | 缺票登记 */
//
/* -------------------------------------------------------- | 缺票登记 */
//
@Bean
//
@Bean
public
Subscription
subscriptionGoblinOrderC0
(
RedisConnectionFactory
factory
)
{
//
public Subscription subscriptionGoblinOrderC0(RedisConnectionFactory factory) {
var
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
//
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var
subscription
=
receiveGoblinOrderCOrder
(
listenerContainer
,
0
);
//
var subscription = receiveGoblinOrderCOrder(listenerContainer, 0);
listenerContainer
.
start
();
//
listenerContainer.start();
return
subscription
;
//
return subscription;
}
//
}
// @Bean
// @Bean
// public Subscription subscriptionGoblinOrderC1(RedisConnectionFactory factory) {
// public Subscription subscriptionGoblinOrderC1(RedisConnectionFactory factory) {
...
@@ -60,7 +66,21 @@ public class ConsumerGoblinOrderCRedisStreamConfig extends RedisStreamConfig {
...
@@ -60,7 +66,21 @@ public class ConsumerGoblinOrderCRedisStreamConfig extends RedisStreamConfig {
// return subscription;
// return subscription;
// }
// }
/* -------------------------------------------------------- | */
/* -------------------------------------------------------- | */
@Bean
//
public
List
<
Subscription
>
subscriptionSqlArtworkGen
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
GOBLIN_ORDER_CLOSE
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
StreamOffset
.
create
(
stream
.
getKey
(),
ReadOffset
.
lastConsumed
()),
consumerGoblinOrderCloseRdsReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
}
}
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