我的组织正在考虑将Jabber用作设备到应用程序消息传递协议的不可知设备.
有没有人知道微软与Jabber竞争对手的最佳实践?或者,一个新兴的竞争对手?并且,如果是这样,一个很好的URL参考,以获得一个快速启动?
Jabber的网站:http: //www.jabber.org/web/Main_Page
所以我正在构建一个客户端服务器应用程序,我必须选择他们将如何相互交谈.我可以:
什么地方有一个矩阵可以告诉我在哪里使用这些技术之一.性能,可靠性等等都会有所帮助.
我们在 ActiveMQ 中遇到了一个问题,我们有大量的消息没有脱离主题。主题设置为非持久性、非持久性。我们的 Activemq.xml 文件是
<beans>
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" persistent="false">
<!--
<persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
</persistenceAdapter>
-->
<transportConnectors>
<transportConnector uri="vm://localhost"/>
</transportConnectors>
</broker>
</beans>
Run Code Online (Sandbox Code Playgroud)
我们在 messages-config.xml 中的主题定义是
<destination id="traceChannel">
<properties>
<network>
<session-timeout>10</session-timeout>
</network>
<server>
<message-time-to-live>10000</message-time-to-live>
<durable>false</durable>
<durable-store-manager>flex.messaging.durability.FileStoreManager</durable-store-manager>
</server>
<jms>
<destination-type>Topic</destination-type>
<message-type>javax.jms.ObjectMessage</message-type>
<connection-factory>ConnectionFactory</connection-factory>
<destination-jndi-name>dynamicTopics/traceTopic</destination-jndi-name>
<delivery-mode>NON_PERSISTENT</delivery-mode>
<message-priority>DEFAULT_PRIORITY</message-priority>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<transacted-sessions>false</transacted-sessions>
<initial-context-environment>
<property>
<name>Context.INITIAL_CONTEXT_FACTORY</name>
<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
</property>
<property>
<name>Context.PROVIDER_URL</name>
<value>tcp://localhost:61616</value>
</property>
</initial-context-environment>
</jms>
</properties>
<channels>
<channel ref="rtmps" />
</channels>
<adapter ref="trace" />
</destination>
Run Code Online (Sandbox Code Playgroud)
我想要实现的是,在任何时候都只有最后 10 条消息是关于主题的,因为让它在一夜之间运行会导致超过 150K 的关于该主题的消息,即使它应该只包含很少的数字。
这样的系统是否可行?
我们可以实现以下功能:(全部)
请帮帮我!
我使用以下代码写入Kafka:
String partitionKey = "" + System.currentTimeMillis();
KeyedMessage<String, String> data = new KeyedMessage<String, String>(topic, partitionKey, payload);
Run Code Online (Sandbox Code Playgroud)
我们使用的是Kafka的0.8.1.1版本.
有可能当多个线程正在写入时,其中一些(具有不同的有效负载)使用相同的分区键写入,因此Kafka会覆盖这些消息(由于相同的partitionKey)?
让我们朝这个方向思考的文档是:http: //kafka.apache.org/documentation.html#compaction
我需要为邮件设置生存时间。
我尝试了以下示例,但是生存时间将被忽略。:/
context.xml
<int:channel id="publishChannel"/>
<int-jms:outbound-channel-adapter
channel="publishChannel"
destination="defaultDestination"
time-to-live="5000"
pub-sub-domain="false" />
Run Code Online (Sandbox Code Playgroud)
发行人
import org.springframework.integration.annotation.Publisher;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.stereotype.Service;
@Service("publishService")
public class PublishService{
private MessageChannel messageChannel;
@Publisher(channel = "publishChannel")
public Message<?> sendMessage (Message<?> message) {
return message;
}
}
Run Code Online (Sandbox Code Playgroud)
我希望有一个人可以帮助我!:)
我有一个在Elastic Beanstalk上运行的worker,它通过队列中的消息接受POST请求.这些消息会触发长时间操作,这需要几分钟(有时甚至是几小时),并且此操作仅执行一次至关重要.
问题是,当我登录到工作台控制台查看进程时,消息似乎每隔一分钟一遍又一遍地传递(通过接收请求触发的方法每分钟调用一次).我怎样才能摆脱这种行为?
我阅读了文档,并将可见超时时间设置为服务队列和死信队列的最大值(12小时).然而,这确实没有任何帮助.
当我发送消息时,它显示为"在飞行中"(这是一种假定的行为,我认为,因为队列等待接收删除请求或某种答案,仅在长时间操作结束时提供) .
有人会暗示我在这种情况下发生了什么吗?我可能错过了配置中的一些重要细节......
编辑:只要它在"飞行中",似乎每分钟都会重新传递消息.完成此过程后,消息最终消失.
我有一个复杂的视图类,
class Snap:UIViewController, UIScrollViewDelegate
{
}
Run Code Online (Sandbox Code Playgroud)
最终的结果是,用户可以选择一种颜色......
protocol SnapProtocol:class
{
func colorPicked(i:Int)
}
class Snap:UIViewController, UIScrollViewDelegate
{
someDelegate.colorPicked(blah)
}
Run Code Online (Sandbox Code Playgroud)
那么谁将会处理它.
让我们说你肯定知道响应者链上有什么东西,甚至走过容器视图,这是一个SnapProtocol.如果是这样,您可以使用这个可爱的代码来调用它
var r : UIResponder = self
repeat { r = r.nextResponder()! } while !(r is SnapProtocol)
(r as! SnapProtocol).colorPicked(x)
Run Code Online (Sandbox Code Playgroud)
如果您愿意,可以使用此最佳扩展名
public extension UIResponder // walk up responder chain
{
public func next<T>() -> T?
{
guard let responder = self.nextResponder()
else { return nil }
return (responder as? T) ?? responder.next()
}
} …Run Code Online (Sandbox Code Playgroud) 我们开始在后端重新开发中使用 Kafka,并且有一个关于如何构建我们生产和消费的消息的快速问题。
想象一下,我们有一个用户微服务来处理用户的 CRUD 操作。作为一种可能性提出的两种结构是:
1)四个kafka主题,每个操作一个。消息值将只包含执行操作所需的数据,即
topic: user_created
message value: {
firstName: 'john'
surname: 'smith'
}
topic: user_deleted
message value: c73035d0-6dea-46d2-91b8-d557d708eeb1 // A UUID
and so on
Run Code Online (Sandbox Code Playgroud)
2) 用户相关事件的单个主题,消息上有一个属性,描述要采取的操作以及所需的数据,即
// User created
topic: user_events
message value: {
type: 'user_created',
payload: {
firstName: 'john'
surname: 'smith'
}
}
// User deleted
topic: user_events
message value: {
type: 'user_deleted',
payload: c73035d0-6dea-46d2-91b8-d557d708eeb1 // A UUID
}
Run Code Online (Sandbox Code Playgroud)
我赞成所描述的第一个系统,尽管我对 Kafka 的缺乏经验使我无法强烈争论为什么。我们非常重视来自更有经验的用户的任何意见。
免责声明.我有使用Hazelcast和Vert.x的经验.我是Apache Kafka的新手.对不起,如果我的问题看起来有先入为主,那就不是了.
有两种广泛的方式来安排微服务之间的通信:REST和消息传递.在我所在的地区,当有人说他们正在使用消息传递微服务之间的通信时 - 事实上它意味着Apache Kafka.
你能否帮我找到一个线索,为什么Apache Kafka比Hazelcast的Topic更适合微服务之间的通信需求?好点吗?由于哪些保证,功能或架构决策?
Hazelcast的集群范围消息传递示例如下:
// node #1
Hazelcast.newHazelcastInstance()
.getTopic("topic")
.publish(new Date());
// node #2
Hazelcast.newHazelcastInstance()
.getTopic("topic");
.addMessageListener(message -> /*Do something here*/);
Run Code Online (Sandbox Code Playgroud)
还有一些Vertmel(非常讨厌的演员框架)写在Hazelcast的主题和成员发现之上.
Kafka的消息是否更适合微服务之间的通信?