You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i send via Stompngo I seem to be publishing messages as ActiveMqByte Messages
Jan 06 15:26:32 DEBUG tropo-cdr2 [voiceCdrSpringListenerBillwise-1] BillingBridge - Received message of type [class org.apache.activemq.command.ActiveMQBytesMessage] from consumer [ActiveMQMessageConsumer { value=ID:tropo-cdr2.prod.us-west-2xxxxxxx-43243-1417638886581-0:0:1:1, started=true }] of session [PooledSession { ActiveMQSession {id=ID:tropo-cdr2.prod.us-west-2.aws.xxxxxx-43243-1417638886581-0:0:1,started=true} }]
I am using the Send function which as I understand it should be sending a string to the queue
package main
import (
"bufio""fmt""github.com/gmallard/stompngo""gopkg.in/alecthomas/kingpin.v1""net""os"
)
var (
queueName=kingpin.Flag("queue", "Destination").Default("/queue/client_test").Short('q').String()
serverAddr=kingpin.Flag("server", "STOMP server endpoint").Default("127.0.0.1").Short('s').String()
serverPort=kingpin.Flag("port", "STOMP server port").Default("61613").Short('p').String()
fileToProcess=kingpin.Flag("file", "File to process").Short('f').String()
workerCount=kingpin.Flag("workers", "Number of workers to send/receive").Short('w').Int()
serverUser=kingpin.Flag("user", "Username").OverrideDefaultFromEnvar("STOMP_USER").String()
serverPass=kingpin.Flag("pass", "Password").OverrideDefaultFromEnvar("STOMP_PASS").String()
clientClientdone=make(chanbool)
)
//var done = make(chan bool)typeClientstruct {
HoststringPortstringUserstringPasswordstringUuidstringQueuestringNetConnection net.ConnStompConnection*stompngo.Connection
}
funcinit() {
kingpin.Version("0.0.1")
kingpin.Parse()
// Set default of 4 workersif*workerCount==0 {
*workerCount=4
}
}
// Setups connection optionsfunc (client*Client) setOpts() {
client.Host=*serverAddrclient.Port=*serverPortclient.Uuid=stompngo.Uuid()
client.Queue=*queueNameif*serverUser!="" {
client.User=*serverUser
}
if*serverPass!="" {
client.Password=*serverPass
}
}
// Creates net connectionfunc (client*Client) netConnection() (conn net.Conn, errerror) {
conn, err=net.Dial("tcp", net.JoinHostPort(client.Host, client.Port))
iferr!=nil {
fmt.Println(err)
returnnil, err
}
client.NetConnection=connreturn
}
func (client*Client) stompConnection() *stompngo.Connection {
headers:= stompngo.Headers{
"accept-version", "1.1",
"host", client.Host,
"login", client.User,
"passcode", client.Password,
}
conn, err:=stompngo.Connect(client.NetConnection, headers)
iferr!=nil {
fmt.Println(err)
os.Exit(0)
}
client.StompConnection=connreturnconn
}
func (client*Client) Connect() (conn*stompngo.Connection) {
client.setOpts()
client.netConnection()
conn=client.stompConnection()
return
}
func (client*Client) Disconnect() {
client.StompConnection.Disconnect(stompngo.Headers{})
client.NetConnection.Close()
}
// Start main////funcmain() {
fmt.Println("Starting connection")
_=client.Connect()
deferclient.Disconnect()
dataCh:=make(chanstring, *workerCount)
// Start workersfmt.Println("Create workers")
forid:=1; id<=*workerCount; id++ {
gosender(id, &client, dataCh)
}
// Start reader go routinefmt.Println("Read file")
gofileReader(*fileToProcess, dataCh)
<-donefmt.Println("Done")
}
// Read from file and put data line by line on channelfuncfileReader(pathstring, dataChchan<-string) {
inFile, _:=os.Open(path)
deferinFile.Close()
scanner:=bufio.NewScanner(inFile)
scanner.Split(bufio.ScanLines)
forscanner.Scan() {
dataCh<-scanner.Text()
}
close(dataCh)
}
// Read from channel and put on queuefuncsender(idint, client*Client, dataCh<-chanstring) {
formessage:=rangedataCh {
headers:= stompngo.Headers{"destination", *queueName, "id", client.Uuid, "persistent", "true"}
err:=client.StompConnection.Send(headers, message)
iferr!=nil {
fmt.Println(err)
}
}
done<-true
}
The text was updated successfully, but these errors were encountered:
when i send via Stompngo I seem to be publishing messages as ActiveMqByte Messages
I am using the
Send
function which as I understand it should be sending a string to the queueThe text was updated successfully, but these errors were encountered: