使用Net :: Stomp :: Client发送二进制消息

时间:2019-09-25 20:40:06

标签: perl activemq stomp messagebroker

我需要使用perl库send将二进制消息发送到Message Broker。但是,每当我使用send_with_receiptActiveMQ方法发送消息时,该消息就会作为文本消息接收。 我在服务器中使用TextMessage,当我调用消耗时,收到的消息的类型为BytesMessage。我需要它的类型为Public Sub SearchButton_Click() Dim RowNum As Long Dim SearchRow As Long Dim coll As Object Set coll = CreateObject("System.Collections.ArrayList") RowNum = 2 SearchRow = 2 Do Until Cells(RowNum, 1).Value = "" If InStr(1, Cells(RowNum, 1).Value, SearchTextBox.Value, vbTextCompare) > 0 Then Worksheets("Search_Results").Cells(SearchRow, 1).Value = Cells(RowNum, 1).Value Worksheets("Search_Results").Cells(SearchRow, 2).Value = Cells(RowNum, 2).Value Worksheets("Search_Results").Cells(SearchRow, 3).Value = Cells(RowNum, 3).Value Worksheets("Search_Results").Cells(SearchRow, 4).Value = Cells(RowNum, 4).Value Worksheets("Search_Results").Cells(SearchRow, 5).Value = Cells(RowNum, 5).Value Worksheets("Search_Results").Cells(SearchRow, 6).Value = Cells(RowNum, 6).Value Worksheets("Search_Results").Cells(SearchRow, 7).Value = Cells(RowNum, 7).Value Worksheets("Search_Results").Cells(SearchRow, 8).Value = Cells(RowNum, 8).Value Worksheets("Search_Results").Cells(SearchRow, 9).Value = Cells(RowNum, 9).Value SearchRow = SearchRow + 1 coll.Add RowNum End If RowNum = RowNum + 1 Loop If SearchRow = 2 Then MsgBox "No products were found that match your search criteria" Exit Sub End If SearchResultsListBox.RowSource = "SearchResults" End Sub Private Sub SearchResultsListBox_Click() NumberIndex = SearchResultsListBox.ListIndex End Sub Public Sub UnassignButton_Click() NumberIndex = SearchResultsListBox.ListIndex MsgBox coll(NumberIndex) End Sub

更新

我在此link中看到,设置content-length标头会将类型设置为Bytes消息...但是我没有找到任何使用Net :: Stomp :: Perl ...的示例。可以提供一个例子,那就太好了...

1 个答案:

答案 0 :(得分:1)

我通过在bytes_message => 1方法中添加send()解决了这个问题 在较新的版本中,您需要使用stomp 1.1或更高版本(默认值为1.0)(将versionaccept_version传递给stomp客户端构造函数)并更高版本并设置content-type