Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
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
徐少华
midjourney-proxy
Commits
0ceecf60
Commit
0ceecf60
authored
Oct 16, 2018
by
songxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
标签使用和用户漏斗MQ
parent
ea57b278
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
87 deletions
+31
-87
FunnelFlowQueueBizImpl.java
...va/com/pcloud/common/core/biz/FunnelFlowQueueBizImpl.java
+22
-48
LabelUsedQueueBizImpl.java
...ava/com/pcloud/common/core/biz/LabelUsedQueueBizImpl.java
+9
-39
No files found.
pcloud-common-core/src/main/java/com/pcloud/common/core/biz/FunnelFlowQueueBizImpl.java
View file @
0ceecf60
package
com
.
pcloud
.
common
.
core
.
biz
;
package
com
.
pcloud
.
common
.
core
.
biz
;
import
javax.jms.JMSException
;
import
org.springframework.amqp.core.AmqpTemplate
;
import
javax.jms.ObjectMessage
;
import
javax.jms.Session
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.jms.core.MessageCreator
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.constant.FunnelFlowStruct.FlowNode
;
import
com.pcloud.common.core.constant.FunnelFlowStruct.FlowNode
;
import
com.pcloud.common.core.constant.FunnelFlowStruct.TargetRoleType
;
import
com.pcloud.common.core.constant.FunnelFlowStruct.TargetRoleType
;
import
com.pcloud.common.core.constant.FunnelFlowStruct.TargetType
;
import
com.pcloud.common.core.constant.FunnelFlowStruct.TargetType
;
import
com.pcloud.common.core.constant.MQQueueConstant
;
import
com.pcloud.common.core.dto.FunnelFlowQueueDto
;
import
com.pcloud.common.core.dto.FunnelFlowQueueDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
/**
/**
* @描述: 发送模板消息队列实现类
* @描述: 发送模板消息队列实现类 @作者: shuyh @创建时间: 2018年1月9日 @版本:1.0
* @作者: shuyh
* @创建时间: 2018年1月9日
* @版本:1.0
*/
*/
@Component
(
"funnelFlowQueueBiz"
)
@Component
(
"funnelFlowQueueBiz"
)
public
class
FunnelFlowQueueBizImpl
implements
FunnelFlowQueueBiz
{
public
class
FunnelFlowQueueBizImpl
implements
FunnelFlowQueueBiz
{
/**
*
*/
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
FunnelFlowQueueBizImpl
.
class
);
@Autowired
(
required
=
false
)
@Qualifier
(
"jmsFunnelFlowTemplate"
)
private
JmsTemplate
jmsFunnelFlowTemplate
;
@Autowired
(
required
=
false
)
@Autowired
@Qualifier
(
"funnelFlowQueue"
)
private
AmqpTemplate
amqpTemplate
;
private
ActiveMQQueue
funnelFlowQueue
;
/**
/**
*
发送队列
*
用户漏斗QUEUE
*/
*/
@Override
@Override
@ParamLog
(
"用户漏斗QUEUE"
)
public
void
sendMessageQueue
(
FunnelFlowQueueDto
funnelFlowQueueDto
)
throws
BizException
{
public
void
sendMessageQueue
(
FunnelFlowQueueDto
funnelFlowQueueDto
)
throws
BizException
{
MessageCreator
messageCreator
=
new
MessageCreator
()
{
amqpTemplate
.
convertAndSend
(
MQQueueConstant
.
FUNNEL_FLOW
,
funnelFlowQueueDto
);
@Override
public
ObjectMessage
createMessage
(
Session
session
)
throws
JMSException
{
return
session
.
createObjectMessage
(
funnelFlowQueueDto
);
}
};
try
{
jmsFunnelFlowTemplate
.
send
(
funnelFlowQueue
,
messageCreator
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"发送失败,"
+
e
.
getMessage
()
+
","
+
funnelFlowQueueDto
,
e
);
throw
BizException
.
SEND_QUEUE_FAIL
;
}
logger
.
info
(
"发送成功,"
+
funnelFlowQueueDto
);
}
}
/**
/**
* 发送队列
* 发送队列
*/
*/
@Override
@Override
public
void
sendMessageQueue
(
TargetType
targetType
,
TargetRoleType
targetRoleType
,
FlowNode
flowNode
,
String
ip
,
String
userAgent
)
throws
BizException
{
public
void
sendMessageQueue
(
TargetType
targetType
,
TargetRoleType
targetRoleType
,
FlowNode
flowNode
,
String
ip
,
FunnelFlowQueueDto
funnelFlowQueueDto
=
new
FunnelFlowQueueDto
(
targetType
,
targetRoleType
,
flowNode
,
ip
,
userAgent
);
String
userAgent
)
throws
BizException
{
FunnelFlowQueueDto
funnelFlowQueueDto
=
new
FunnelFlowQueueDto
(
targetType
,
targetRoleType
,
flowNode
,
ip
,
userAgent
);
sendMessageQueue
(
funnelFlowQueueDto
);
sendMessageQueue
(
funnelFlowQueueDto
);
}
}
...
@@ -75,8 +45,10 @@ public class FunnelFlowQueueBizImpl implements FunnelFlowQueueBiz{
...
@@ -75,8 +45,10 @@ public class FunnelFlowQueueBizImpl implements FunnelFlowQueueBiz{
* 发送队列
* 发送队列
*/
*/
@Override
@Override
public
void
sendMessageQueue
(
TargetType
targetType
,
Long
targetId
,
TargetRoleType
targetRoleType
,
Long
targetRoleId
,
FlowNode
flowNode
)
throws
BizException
{
public
void
sendMessageQueue
(
TargetType
targetType
,
Long
targetId
,
TargetRoleType
targetRoleType
,
Long
targetRoleId
,
FunnelFlowQueueDto
funnelFlowQueueDto
=
new
FunnelFlowQueueDto
(
targetType
,
targetId
,
targetRoleType
,
targetRoleId
,
flowNode
);
FlowNode
flowNode
)
throws
BizException
{
FunnelFlowQueueDto
funnelFlowQueueDto
=
new
FunnelFlowQueueDto
(
targetType
,
targetId
,
targetRoleType
,
targetRoleId
,
flowNode
);
sendMessageQueue
(
funnelFlowQueueDto
);
sendMessageQueue
(
funnelFlowQueueDto
);
}
}
...
@@ -84,8 +56,10 @@ public class FunnelFlowQueueBizImpl implements FunnelFlowQueueBiz{
...
@@ -84,8 +56,10 @@ public class FunnelFlowQueueBizImpl implements FunnelFlowQueueBiz{
* 发送队列
* 发送队列
*/
*/
@Override
@Override
public
void
sendMessageQueue
(
TargetType
targetType
,
Long
targetId
,
String
subtypeCode
,
TargetRoleType
targetRoleType
,
Long
targetRoleId
,
FlowNode
flowNode
)
throws
BizException
{
public
void
sendMessageQueue
(
TargetType
targetType
,
Long
targetId
,
String
subtypeCode
,
FunnelFlowQueueDto
funnelFlowQueueDto
=
new
FunnelFlowQueueDto
(
targetType
,
targetId
,
subtypeCode
,
targetRoleType
,
targetRoleId
,
flowNode
);
TargetRoleType
targetRoleType
,
Long
targetRoleId
,
FlowNode
flowNode
)
throws
BizException
{
FunnelFlowQueueDto
funnelFlowQueueDto
=
new
FunnelFlowQueueDto
(
targetType
,
targetId
,
subtypeCode
,
targetRoleType
,
targetRoleId
,
flowNode
);
sendMessageQueue
(
funnelFlowQueueDto
);
sendMessageQueue
(
funnelFlowQueueDto
);
}
}
...
...
pcloud-common-core/src/main/java/com/pcloud/common/core/biz/LabelUsedQueueBizImpl.java
View file @
0ceecf60
package
com
.
pcloud
.
common
.
core
.
biz
;
package
com
.
pcloud
.
common
.
core
.
biz
;
import
javax.jms.JMSException
;
import
org.springframework.amqp.core.AmqpTemplate
;
import
javax.jms.ObjectMessage
;
import
javax.jms.Session
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.jms.core.MessageCreator
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.constant.MQQueueConstant
;
import
com.pcloud.common.core.dto.LabelUsedMessageDto
;
import
com.pcloud.common.core.dto.LabelUsedMessageDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
/**
/**
* @描述: 标签使用队列实现类
* @描述: 标签使用队列实现类 @作者: shuyh @创建时间: 2017年5月23日 @版本:1.0
* @作者: shuyh
* @创建时间: 2017年5月23日
* @版本:1.0
*/
*/
@Component
(
"labelUsedQueueBiz"
)
@Component
(
"labelUsedQueueBiz"
)
public
class
LabelUsedQueueBizImpl
implements
LabelUsedQueueBiz
{
public
class
LabelUsedQueueBizImpl
implements
LabelUsedQueueBiz
{
/**
*
*/
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
LabelUsedQueueBizImpl
.
class
);
@Autowired
(
required
=
false
)
@Autowired
@Qualifier
(
"jmsLabelUsedTemplate"
)
private
AmqpTemplate
amqpTemplate
;
private
JmsTemplate
jmsLabelUsedTemplate
;
/**
* 发送队列
*/
@Override
@Override
@ParamLog
(
"标签使用QUEUE"
)
public
void
sendMessageQueue
(
LabelUsedMessageDto
labelUsedMessageDto
)
throws
BizException
{
public
void
sendMessageQueue
(
LabelUsedMessageDto
labelUsedMessageDto
)
throws
BizException
{
MessageCreator
messageCreator
=
new
MessageCreator
()
{
amqpTemplate
.
convertAndSend
(
MQQueueConstant
.
LABEL_USED
,
labelUsedMessageDto
);
@Override
public
ObjectMessage
createMessage
(
Session
session
)
throws
JMSException
{
return
session
.
createObjectMessage
(
labelUsedMessageDto
);
}
};
try
{
jmsLabelUsedTemplate
.
send
(
messageCreator
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"发送失败,"
+
e
.
getMessage
()
+
","
+
labelUsedMessageDto
,
e
);
throw
BizException
.
SEND_QUEUE_FAIL
;
}
logger
.
info
(
"发送成功,"
+
labelUsedMessageDto
);
}
}
}
}
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