public byte[] SendAudioJobToQueue(AudioJob auJob) { AudioReplyQueue rq = new AudioReplyQueue(); var props = rq.Start(auJob.Id.ToString()); props.Persistent = true; props.Headers = new Dictionary <string, object>(); string voiceProp = ""; if (auJob.VoicePropriety.Count() > 0) { if (auJob.VoicePropriety.Count() > 1) { foreach (VoicePropriety vp in auJob.VoicePropriety) { voiceProp += vp + ":"; } voiceProp = voiceProp.Substring(0, voiceProp.Length - 1); } else { voiceProp = "" + auJob.VoicePropriety.First(); } } else { voiceProp = "" + VoicePropriety.None; } props.Headers.Add("inputPropriety", (byte[])Encoding.UTF8.GetBytes(voiceProp)); props.Headers.Add("inputLanguage", (int)auJob.AudioLanguage); props.Headers.Add("voiceSpeed", (int)auJob.SpeedOptions); props.Headers.Add("format", (int)auJob.FormatOptions); //AudioJobSender c = new AudioJobSender(); string key = GetRoutingKey(auJob); Thread pubTrhead = new Thread(() => PublishToTopicConsumer(props, auJob.FileContent, key)); pubTrhead.Start(); //c.PublishToTopicConsumer(props, auJob.FileContent, key); byte[] response = rq.getReply(); return(response); }
public byte[] SendAudioJobToQueue(AudioJob auJob) { AudioReplyQueue rq = new AudioReplyQueue(); var props = rq.Start(auJob.Id.ToString()); props.Headers = new Dictionary<string, object>(); string voiceProp = ""; if (auJob.VoicePropriety.Count() > 1) { foreach (VoicePropriety vp in auJob.VoicePropriety) voiceProp += vp + ":"; voiceProp = voiceProp.Substring(0, voiceProp.Length - 1); } else voiceProp = ""+auJob.VoicePropriety.First(); props.Headers.Add("inputPropriety", (byte[]) Encoding.UTF8.GetBytes(voiceProp)); props.Headers.Add("inputLanguage",(int) auJob.AudioLanguage); props.Headers.Add("voiceSpeed", (int) auJob.SpeedOptions); props.Headers.Add("format", (int) auJob.FormatOptions); string key = GetRoutingKey(auJob); Thread pubTrhead = new Thread(() => PublishToTopicConsumer(props,auJob.FileContent,key)); pubTrhead.Start(); //c.PublishToTopicConsumer(props, auJob.FileContent, key); byte[] response = rq.getReply(); return response; }