Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 865733 Details for
Bug 1067517
Log generated by org.apache.qpid.messaging library onto C# clients stderr is visible only partly
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Improved version of main source file and some explanation
qc2_connector.cs (text/x-csharp), 12.58 KB, created by
Chuck Rolke
on 2014-02-20 22:20:27 UTC
(
hide
)
Description:
Improved version of main source file and some explanation
Filename:
MIME Type:
Creator:
Chuck Rolke
Created:
2014-02-20 22:20:27 UTC
Size:
12.58 KB
patch
obsolete
>/* qc2_connector > -------------- > "connector [(-b|--broker) <broker-url>] [(-c|--connections) <connection_amount>] \n\ > [(--connection-options) <conn_options>] [(-a|--address) <address>] \n\ > [--obj-ctrl <object-ids>] [--sync-mode <smode>] [--duration <dur>] \n\ >\n\ >(-b|--broker) <broker>\n\ > Specify broker to connect in format <IP/name>:<port>\n\ > > default: localhost:5672\n\ >\n\ >(-c|--conn-cnt) <connection_count>\n\ > Specify how many connection connector try to create and open\n\ > > default: 1\n\ >\n\ >(--connection-options) <connection_options>\n\ > Optional connection options (authentication, reconnect, etc.)\n\ > e.g. --connection-options \"{ username:X, password: Y, sasl_mechanisms: PLAIN}\"\n\ > > default: none\n\ >(-a|--address) <address>\n\ > Optional AMQP address used for address creation / deletion / check of existance\n\ > e.g. -a \"MYQUEUE; {create: always, delete: receiver}\"\n\ > > default: none\n\ >(--obj-ctrl) <object-ids>\n\ > Optional creation object control based on <object-ids>\n\ > syntax C/E/S/R stands for Connection, sEssion, Sender, Receiver\n\ > e.g. --obj-ctrl \"CES\" for creation of Connection+sEssion+Sender\n\ > > default: \"C\" (address not given) \"CESR\" (address specified)\n\ >(--sync-mode) <smode>\n\ > Optional action synchronization mode: none/session/action\n\ > syntax none / session / action corresponds to \n\ > never / before session.close() / at every operation\n\ > e.g. --sync-mode \"session\"\n\ > > default: \"action\"\n\ >\n\ >--duration <dur> \n\ > Opened objects will be held until duration passes by \n\ > Also the sessions if exists will be synced every T=1s \n\ > */ > >/** ECODE TABLE > * 0 - EOK > * 1 - General Error > * 2 - Bad Usage Error > */ > >using System; >using System.Collections.Generic; >using System.Threading; >using System.Collections; >using System.Collections.ObjectModel; >using System.Text.RegularExpressions; > > >using Org.Apache.Qpid.Messaging; > > >namespace Org.Apache.Qpid.Messaging.Examples >{ > class Qc2Connector > { > static int Main(string[] args) > { > int result = 0; > double wait_time = 0.0; > > > // declare number of connections > // ------------------------------------------------------------------------ > Collection<Connection> con_list = new Collection<Connection>(); > Collection<Session> ssn_list = new Collection<Session>(); > Collection<Sender> snd_list = new Collection<Sender>(); > Collection<Receiver> rcv_list = new Collection<Receiver>(); > > Qc2ConnectorOptionParser options = new Qc2ConnectorOptionParser(); > > try > { > options.Parse(args); > > //request to create at least connection > if (Regex.IsMatch(options.ObjCtrl, "[CESR]")) > { > > //create connections > for (int i = 0; i < options.ConnectionCnt; i++) > { > Connection tmp_connection = new Connection(options.Url, options.ConnectionOptions); > con_list.Add(tmp_connection); > } > > //open connections > foreach (Connection conn in con_list) > { > conn.Open(); > } > > //Thread.Sleep(100); > //check opened / not opened connections > int opened = 0; > int not_opened = 0; > foreach (Connection conn in con_list) > { > if (conn.IsOpen) > { > opened++; > } > else > { > not_opened++; > } > } > Console.WriteLine(opened + " " + not_opened + " " + options.ConnectionCnt); > > > //request to create at least session (connection needed) > if (Regex.IsMatch(options.ObjCtrl, "[ESR]")) > { > try > { > //session part for opened connections > foreach (Connection conn in con_list) > { > if (conn.IsOpen) > { > Session s = conn.CreateSession(); > ssn_list.Add(s); > if (options.Sync_mode == "action") > { > s.Sync(); > } > } > else > { > ssn_list.Add(null); > } > } > } > catch (QpidException qe) > { > Console.WriteLine(qe.Message); > for (int i = ssn_list.Count; i < con_list.Count; i++) > { > ssn_list.Add(null); > } > > } > > // further object require non-empty address > if (options.Address != "") > { > // sender part (if address is specified) > // create senders for opened sessions > if (Regex.IsMatch(options.ObjCtrl, "[S]")) > { > try > { > foreach (Session s in ssn_list) > { > if (s != null) > { > Sender snd = s.CreateSender(options.Address); > snd_list.Add(snd); > if (options.Sync_mode == "action") > { > s.Sync(); > } > } > else > { > snd_list.Add(null); > } > } > } > catch (QpidException qes) > { > Console.WriteLine(qes.Message); > for (int i = snd_list.Count; i < ssn_list.Count; i++) > { > snd_list.Add(null); > } > } > } > if(Regex.IsMatch(options.ObjCtrl, "[R]")) > { > try > { > foreach (Session s in ssn_list) > { > if (s != null) > { > Receiver rcv = s.CreateReceiver(options.Address); > rcv_list.Add(rcv); > if (options.Sync_mode == "action") > { > s.Sync(); > } > } > else > { > rcv_list.Add(null); > } > } > } > catch (QpidException qer) > { > Console.WriteLine(qer.Message); > for (int i = rcv_list.Count; i < ssn_list.Count; i++) > { > rcv_list.Add(null); > } > } > } > } > } > > // hold mode (infinite loop, signal has to come to exit the app) > if (options.Duration != 0) > { > double ts = Utils.get_time(); > int wait_rounds = (int)(options.Duration / wait_time); > for (int wait_round = 0; wait_round < wait_rounds; wait_round++) > { > //sleep before if duration is positive > if (options.Duration > 0) > { > Utils.sleep4next(ts, wait_rounds, options.Duration, wait_round + 1); > } > if (Regex.IsMatch(options.ObjCtrl, "[ESR]")) > { > foreach (Session s in ssn_list) > { > if (s != null) > { > s.Sync(); > } > } > } > if (options.Duration < 0) > { > Utils.sleep4next(ts, wait_rounds, Math.Abs(options.Duration), wait_round + 1); > } > } > } > > //--sync-mode=session sync() action (before) objects get closed > if ((Regex.IsMatch(options.ObjCtrl, "[ESR]")) && (options.Sync_mode == "session")) > { > foreach (Session s in ssn_list) > { > if (s != null) > { > s.Sync(); > } > } > } > } > } > catch (Exception ex) > { > result = 1; > Console.WriteLine("Exception occurred: " + ex.Message); > } > finally > { > //close objects > foreach (Sender snd in snd_list) > { > if (snd != null) > { > snd.Close(); > snd.Dispose(); // Release bound C++ object > } > } > foreach (Receiver rec in rcv_list) > { > if ((rec != null) && (!rec.IsClosed)) > { > rec.Close(); > rec.Dispose(); // Release bound C++ object > } > } > foreach (Session ses in ssn_list) > { > if (ses != null) > { > ses.Close(); > ses.Dispose(); // Release bound C++ object > } > } > foreach (Connection conn in con_list) > { > //if ((con_list != null) && (!conn.IsOpen)) > if (conn.IsOpen) > { > // Comment out this conn.Close to make the client warning messages appear > conn.Close(); > } > conn.Dispose(); // Release bound C++ object > } > > // Remove references to .NET objects so they may be garbage collected > snd_list.Clear(); > rcv_list.Clear(); > ssn_list.Clear(); > con_list.Clear(); > > // Force a garbage collection cycle > GC.Collect(); > GC.WaitForPendingFinalizers(); > > // Sleep to let messages percolate > System.Threading.Thread.Sleep(1000); > } > return result; > } > } >} > >//eof
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1067517
: 865733