Quartz.net can't connect to Postgres DB - quartz-scheduler

Here is my config:
["quartz.jobStore.dataSource"] = "default",
["quartz.jobStore.tablePrefix"] = "QRTZ_",
["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.PostgreSQLDelegate, Quartz",
["quartz.dataSource.default.provider"] = "Npgsql",
["quartz.dataSource.default.connectionString"] = #"User ID=ttt;Password=xxx;Host=ttt.postgres;Port=5432;Database=ttt;"
Exception:
Could not parse property 'dataSource' into correct data type: No writable property 'DataSource' found
I've been trying different things for over an hour, the docs don't really help (slim on the examples front) and I've tried to dig through the Quartz.Net source but no luck :/

Adding this seems to have fixed it - i'm not 100% up and running but I have gotten further...
properties["quartz.scheduler.instanceName"] = "SonatribeScheduler";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "10";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz";
properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";

Related

How to remove the following character "/" from service path

Good Morning!
Currently I have set up my structure in Fiware saving my historical records in MongoDB, for this I have been using Mlab as a hosting.
I attache the configuration file of my agent, the problem comes in that due to the mandatory character "/" of the service path I can not access the generated historical data, since it is a character not allowed for collections in MongoDB.
agent_1.conf
cygnus-ngsi.sources = http-source
cygnus-ngsi.sinks = mongo-sink
cygnus-ngsi.channels = mongo-channel
cygnus-ngsi.sources.http-source.channels = mongo-channel
cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnus-ngsi.sources.http-source.port = 5050
cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
cygnus-ngsi.sources.http-source.handler.notification_target = /notify
cygnus-ngsi.sources.http-source.handler.default_service = default
cygnus-ngsi.sources.http-source.handler.default_service_path = /sevilla
cygnus-ngsi.sources.http-source.handler.events_ttl = 2
cygnus-ngsi.sources.http-source.interceptors = ts
cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
cygnus-ngsi.sinks.mongo-sink.type = com.telefonica.iot.cygnus.sinks.NGSIMongoSink
cygnus-ngsi.sinks.mongo-sink.channel = mongo-channel
cygnus-ngsi.sinks.mongo-sink.enable_encoding = false
cygnus-ngsi.sinks.mongo-sink.enable_grouping = false
cygnus-ngsi.sinks.mongo-sink.enable_name_mappings = false
cygnus-ngsi.sinks.mongo-sink.enable_lowercase = false
cygnus-ngsi.sinks.mongo-sink.data_model = dm-by-service-path
cygnus-ngsi.sinks.mongo-sink.attr_persistence = row
cygnus-ngsi.sinks.mongo-sink.mongo_hosts = ds******.mlab.com:35866
cygnus-ngsi.sinks.mongo-sink.mongo_username = my_user
cygnus-ngsi.sinks.mongo-sink.mongo_password = ********
cygnus-ngsi.sinks.mongo-sink.db_prefix = sth_
cygnus-ngsi.sinks.mongo-sink.collection_prefix = sth_
cygnus-ngsi.sinks.mongo-sink.batch_size = 1
cygnus-ngsi.sinks.mongo-sink.batch_timeout = 30
cygnus-ngsi.sinks.mongo-sink.batch_ttl = 10
cygnus-ngsi.sinks.mongo-sink.data_expiration = 0
cygnus-ngsi.sinks.mongo-sink.collections_size = 0
cygnus-ngsi.sinks.mongo-sink.max_documents = 0
cygnus-ngsi.sinks.mongo-sink.ignore_white_spaces = true
cygnus-ngsi.channels.mongo-channel.type = com.telefonica.iot.cygnus.channels.CygnusMemoryChannel
cygnus-ngsi.channels.mongo-channel.capacity = 1000
cygnus-ngsi.channels.mongo-channel.transactionCapacity = 100
Is there any way for Cygnus to remove the "/" character from the service path?
Error: http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9827048captura-de-pantalla.png
SOLUTION: You just have to change the enconding to true in the agent configuration
cygnus-ngsi.sinks.mongo-sink.enable_encoding = true
Thank you very much!

Quartz : There is no DataSource named 'myDS'

When i use datasource name as "quartzDS" everything is working fine, but when i change datasource name to any other name any other like "myDS". i get error.
Caused by: java.sql.SQLException: There is no DataSource named 'myDS'
My quartz.properties file.
org.quartz.scheduler.instanceName = QuartzClusterScheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 100
org.quartz.threadPool.threadPriority = 8
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 5000
org.quartz.dataSource.quartzDS.jndiURL = java:jboss/myDS
Resolved, Changed from
org.quartz.dataSource.quartzDS.jndiURL = java:jboss/myDS
to
org.quartz.dataSource.myDS.jndiURL = java:jboss/myDS

Quartz schedulers controlled from an external app

I am currently working on Quartz.NET (version 2.3.1). I have created different Schedulers with different jobs using the code below (for each scheduler):
NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "QuartzSchedulerTest";
properties["quartz.scheduler.instanceId"] = AUTO;
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.clustered"] = "true";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz";
properties["quartz.dataSource.default.connectionString"] = "myConnString"
properties["quartz.dataSource.default.provider"] = "SqlServer-20";
// Get scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler scheduler = sf.GetScheduler();
Now I have all scheduling information stored on a SQL database and everything works.
I created a new Console Application because I need to manage all schedulers (get schedulers list, jobs for each scheduler, send command to pause and resume triggers ecc...).
This is the code I wrote to try to have handlers to all existing schedulers:
NameValueCollection properties = new NameValueCollection();
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.clustered"] = "true";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz";
properties["quartz.dataSource.default.connectionString"] = "myConnString"
properties["quartz.dataSource.default.provider"] = "SqlServer-20";
// Get scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);
var schedulers = sf.AllSchedulers;
But no handlers returned (schedulers count is 0). Can anyone tell me how can I get all schedulers? Is it possible?
Sorry for my english and thanks in advance.
You have to connect to each scheduler instance directly using remoting. The schedulers are not aware of each other and there is no way to get a list of all of the schedulers that are in a cluster.
Once you connect to each scheduler then you'll be able to pull a list of running jobs and manipulate the job schedule as necessary. If all of the schedulers are in a cluster, then you don't have to connect to all of them to manipulate the jobs themselves. You can do that from any of the instances. However, the list of running jobs has to be compiled by asking each scheduler individually.

Paypal DoDirectPaymentRequest returning NULL

I am using Paypal's classic API to do a Direct Payment. Here's the code:
require('merchant-sdk-php-master/samples/PPBootStrap.php');
$logger = new PPLoggingManager('DoDirectPayment');
$address = new AddressType();
$address->Name = $full_name;
$address->Street1 = $address_1;
$address->Street2 = $address_2;
$address->CityName = $city;
$address->StateOrProvince = $province;
$address->PostalCode = $postal_code;
$address->Country = $country;
$address->Phone = $phone;
$paymentDetails = new PaymentDetailsType();
$paymentDetails->ShipToAddress = $address;
$paymentDetails->OrderTotal = new BasicAmountType('CAD', $amount);
$personName = new PersonNameType();
$personName->FirstName = $first_name;
$personName->LastName = $last_name;
$payer = new PayerInfoType();
$payer->PayerName = $personName;
$payer->Address = $address;
$payer->PayerCountry = $country;
$cardDetails = new CreditCardDetailsType();
$cardDetails->CreditCardNumber = $card_number;
$cardDetails->CreditCardType = $card_type;
$cardDetails->ExpMonth = $expiry_month;
$cardDetails->ExpYear = $expiry_year;
$cardDetails->CVV2 = $cvv;
$cardDetails->CardOwner = $payer;
$ddReqDetails = new DoDirectPaymentRequestDetailsType();
$ddReqDetails->CreditCard = $cardDetails;
$ddReqDetails->PaymentDetails = $paymentDetails;
$ddReqDetails->PaymentAction = 'Sale';
$ddReqDetails->IPAddress = $ip_address;
$ddReqDetails->ReturnFMFDetails = true;
$doDirectPaymentReq = new DoDirectPaymentReq();
$doDirectPaymentReq->DoDirectPaymentRequest = new DoDirectPaymentRequestType($ddReqDetails);
$logger->info("created doDirectPaymentReq Object");
$paypalService = new PayPalAPIInterfaceServiceService();
try{
$doDirectPaymentResponse = $paypalService->DoDirectPayment($doDirectPaymentReq);
var_dump($doDirectPaymentResponse);
}
catch (Exception $ex){
var_dump($ex);
}
This is the object it returns:
object(DoDirectPaymentResponseType)#84 (15) { ["Amount"]=> NULL ["AVSCode"]=> NULL ["CVV2Code"]=> NULL ["TransactionID"]=> NULL ["PendingReason"]=> NULL ["PaymentStatus"]=> NULL ["FMFDetails"]=> NULL ["ThreeDSecureResponse"]=> NULL ["PaymentAdviceCode"]=> NULL ["Timestamp"]=> NULL ["Ack"]=> NULL ["CorrelationID"]=> NULL ["Errors"]=> NULL ["Version"]=> NULL ["Build"]=> NULL } ­
I'm Canadian so I can't use the new API's because they're not available here yet. I'm stuck with the classic API. Why am I getting this result?
Any help is appreciated!
For some reason, yesterday I was getting an object of NULL values. However, today I am getting an error message. I fixed the error and received a success.
Why it was showing me the error message today and not yesterday, I do not know. I never changed any of the code so it must have been something on Paypal's end.
Still have no idea what was wrong, but that's that.

Zend MultiDb resource

I have configured my application to work with multiple databases. The magic works just fine. In my Bootstrap.php I have defined the folowing:
protected function _initDb()
{
$resource = $this->getPluginResource('multidb');
Zend_Registry::set("multidb", $resource);
}
and in my application.ini:
resources.multidb.db1.adapter = mysqli
resources.multidb.db1.host = localhost
resources.multidb.db1.username = user
resources.multidb.db1.password = pass
resources.multidb.db1.dbname = db
resources.multidb.db1.charset= "utf8"
resources.multidb.db1.default= true
resources.multidb.db1.profiler.enabled = true
resources.multidb.oracle.adapter = oracle
resources.multidb.oracle.username = user
resources.multidb.oracle.password = pass
resources.multidb.oracle.charset= "utf8"
resources.multidb.oracle.dbname = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(Host = host.example.com) (Port = 1529)) (CONNECT_DATA = (SID = DB)))"
resources.multidb.oracle.profiler.enabled = true
All of this works just fine. In my models, I usually do something like this in the init():
$multidb = Zend_Registry::get("multidb");
$this->oracle = $multidb->getDb('oracle');
But I recently wanted to move this part to the Bootstrap, or rather, Registry, like this:
protected function _initDb()
{
$resource = $this->getPluginResource('multidb');
Zend_Registry::set("multidb", $resource);
Zend_Registry::set("odb",$resource->getDb('oracle'));
}
And this is what happened:
Fatal error: Uncaught exception 'Zend_Application_Resource_Exception' with message 'A DB adapter was tried to retrieve, but was not configured' in C:\Zend\Apache2\htdocs\Zend\Application\Resource\Multidb.php on line 135
I know a temporary fix around this, but why is this happening, and what could be a more long term fix, so that I could set each adapter in registry, preferably in bootstrap?
Thanks!
I think you have to make sure the multidb resource is bootstrapped in other to be filled. You can do this with the following:
protected function _initDb() {
$this->bootstrap('multidb');
$resource = $this->getPluginResource('multidb');
Zend_Registry::set("multidb", $resource);
Zend_Registry::set("odb",$resource->getDb('oracle'));
}